Question about atom.project and the 'path-changed' event


#1

So I have a package that, on activation, checks for a special file at the current project root. If that file exists, several components in the package are activated. This ensures that we don’t unnecessarily load code that will never be exercised in the current Atom session.

Right now I’m watching atom.project to see if it emits a path-changed event: if it does, I trigger the re-check code.

However, I’m not actually sure what the path-changed event represents. At the time I implemented the re-check code, I assumed that it was possible for an Atom instance to change its current project directory to something else, but I’ve actually never seen that happen in practice: opening a new project always opens a new Atom instance.

Is my understanding of path-changed sound?


#2

It appears that the only way that the Project class’ path-changed event is due to the setPath method being called:

But I believe you are correct in that nothing in Atom proper actually changes the project’s path, only opens a new window. That doesn’t preclude packages from doing so, though.


#3

Thanks lee. I guess I should keep watching path-changed in case someone develops a project management package or something in Atom changes.


#4

Yeah, I would do that … it seems from the comments on Atom core that the project handling in Atom is getting some :eyes: from the Atom team lately. I don’t know if that means things will change soon, but until Atom hits v1.0 … everything is up for grabs.


#5

+1

need this too, something that triggers on folder/project open, change path is not the case as projects open in new window…
hmm… guess that is a new package load because atom restarted.