It seems to have be asked several times, but I couldn't find any answer to this question: how can I get the path of the current project? (from a plugin)
window.folders() gives you a list of folders that are in the project. Perhaps that will give you what you want.
Thanks for your answer.
I found window.folders(), but it's not what I want. This is an arbitrary list of folders, I'm looking for the project file itself.
Take a look at facelessuser's FavoriteFiles plugin. There is some functionality that needs to know where the project file is, but I believe when he did it, it was pretty much a kludge. I haven't looked at the code in a long time, so he may have found a more elegant way to do it.
No, it is still a kludge, but yes I have do have a way to get the project path. In general, it is pretty straight forward, but the file you have to parse isn't always up to date...meaning you can't get the project path unless you force this particular file to update. That is were it gets ugly.
I see... do you think it's better to have the user explicitly set the path in some config file?
Depends on what you want to do. It is certainly the easiest thing to do. Hopefully one day Jon will expose this in the API. I am sure it is always up to date in some memory buffer, but that only gets flushed out to the file on very specific events.
I've done a plugin to sync the source folder of my web projects with the web root folder.
So I'll use pathes explicit set in config files until the API is exposed.
Thanks for your help!