Okay, this is it.
I decided to store settings in the same directory as the project settings, but not in the project settings file. This is because people might be version controlling their project file, and I don’t want to put stuff in it they don’t like.
I added some code to perform a session refresh so I can find project files. So, if I can’t find a project file, I will refresh the session and try 1 more time. If the window does have a project file, I can then find it. You might see a tab pop up and disappear when performing the refresh. This is only needed on newly opened projects when no file has been saved since opening the project.
Basically, I am opening a dummy file, performing a save, and then I close it to refresh the session. If there are no views open, I will not close the dummy file so your window will not automatically close. It will look like this:
[code] ______ _ __ _______ __
/ / __ ______ _____() /____ / () / _____
/ / / __ `/ | / / __ / / / _/ _ \ / / / / / _ / /
/ __/ / // /| |/ / // / / / / // __/ / __/ / / / ( )
// _,/ |/_// //_/_/ // ///___/____/
Attemping to refresh session…
This view is used to refresh your session in order to find the project file if it exists.
To prevent the window from closing, this view will remain open if only one view remains.[/code]
That is it. By doing this ridiculous little task, I am able to update the Auto Save Session.sublime_session file, and then can find where the project file is and store the favorites file with it.
Per project favorites must be toggled on in a project, so by default, you are using the global list. When you want to see project specific favs, you use the “Favorite Files: Toggle Per Project” command. This now will load per project files instead of global. You can toggle back and forth.
If/when Jon adds some method to get the project file path, this will no longer be needed, but until then this is what I plan on doing.
Try it out and let me know if you like it. Let me know if you have any suggestions. Right now, this is what I am planning to submit to Package Control (assuming there are no bugs).
- Abandon storing favs in project settings file, but store the settings in a file in the same directory as project settings.
- Force refresh of session if project cannot be found and try to locate project again.