Zren / atom-package-manager-commands

https://atom.io/packages/package-manager-commands
4 stars 3 forks source link

project.path matching problem. #2

Open mark-hahn opened 10 years ago

mark-hahn commented 10 years ago

I'm seeing a problem that occurs periodically. As per murphy's law it seems to happen at the worst times. Here is a screen cap of the problem.

x

Note that atom.package.path doesn't match the path from atom.packages.getLoadedPackages().

Can I submit a pull request that just checks the last part of the path, like /(\\|/)([^\\/]*)$/?

Zren commented 10 years ago

Oh that's right. Atom encourages you to symlink your dev packages. Hmmm.

What's Package.mainModulePath? for that package? atom.packages.getActivePackage('asdf').mainModulePath

I could also see about recusively checking require.cache['C:\\asdf\\asdf.js'].children from the main module. Need to confirm it doesn't include shared modules though.

mark-hahn commented 10 years ago

What's wrong with just checking the package's name at the end of the path? There can't be two the same.

On Sun, Aug 24, 2014 at 1:40 PM, Chris Holland notifications@github.com wrote:

Oh that's right. Atom encourages you to symlink your dev packages. Hmmm.

What's Package.mainModulePath? for that package? atom.packages.getActivePackage('asdf').mainModulePath

I could also see about recusively checking require.cache['C:\asdf\asdf.js'].children from the main module.

— Reply to this email directly or view it on GitHub https://github.com/Zren/atom-package-manager-commands/issues/2#issuecomment-53206248 .

Zren commented 10 years ago

I believe it was you who first brought up murphy's law. :]

I'd have to check every dir in the path for that token. If I did that, then any package named chocolatey or tools might unload everything.

atom.packages.resourcePath = "c:\chocolatey\lib\Atom.0.123.0\tools\Atom\resources\app"

I could make a blacklist made up from critical paths, but I'd rather go the children route.

mark-hahn commented 10 years ago

I'd have to check every dir in the path for that token.

I don't understand why it wouldn't always be at the end but I'll take your word for it.

On Sun, Aug 24, 2014 at 2:01 PM, Chris Holland notifications@github.com wrote:

I believe it was you who first brought up murphy's law. :]

I'd have to check every dir in the path for that token. If I did that, then any package named chocolatey or tools might unload everything.

atom.packages.resourcePath = "c:\chocolatey\lib\Atom.0.123.0\tools\Atom\resources\app"

I could make a blacklist made up from critical paths, but I'd rather go the children route.

— Reply to this email directly or view it on GitHub https://github.com/Zren/atom-package-manager-commands/issues/2#issuecomment-53208297 .