Sublime Forum

Keep all project files in one place?

#1

Hi,

when I click on “Save Project As…”, sublime proposes to save on the folder of the currently selected file, that will often be deeply nested inside the current project.
That, of course, is not where I want to keep my project files. Arguably, there are two possible ways to arrange project files:

  • Keep each .sublime-project and .sublime-workspace pair in the root of their project folder;
  • Keep all of these files in the same directory, maybe a dedicated one, that only contains project files.

Well, personally I go for the latter, so what I’ll do is, each time I hit “Save Project As…”, browse to find my preferred project directory.

Is it possible to do this automatically?

Also, if I move a project file, Sublime Text 2 will be unhappy when I try to “Switch Project In Window…”. Where does Sublime Text 2 keep its list of past .sublime-project files, so that I can modify it, when needed?

Thanks.

0 Likes

#2

I would second the idea to be able to keep all the project files in the same directory and the question about where sublime keeps its list of past projects for the switch project dialog.

Secondly, I tried keeping all of the project files in the same folder but it ended up getting too large and cumbersome to find the one that I wanted, so, I started explicitly saving my project files in the root of the project folder tree and since sublime takes care of the rest, it doesn’t really matter where you save the project files as long as they don’t move.

0 Likes

#3

I would just create a shortcut in the sidebar of your OS’s window to your project folder so you have a quick link when you save as…that is what I do. I don’t think ST2 really needs to manage that.

0 Likes

#4

Sublime Text stores the list of projects in \Data\Settings\Session.sublime_session, in a key at the end of the file called “workspaces”, relative to your user data area. The exact location depends on your OS and whether you use the portable version or the full installer.

This is a JSON file which you can edit (with another text editor when Sublime Text is not open) to change project files paths, the order of projects, delete unused projects, etc. Make sure to keep the same syntax, particularly the commas at the end of each item except the last one. It may be possible to edit it from Sublime, but that may produce unpleasing results. =)

0 Likes

#5

I’ve been thinking about some of the same issues as the OP. At work, I run a portable Sublime out of my Dropbox. I’ve created a folder to keep all my projects in, but the absolute path changes from computer to computer. Does anyone know if it is possible to treat the path of the project as relative? (It’s only a couple directories over :wink: ) The files within the project should then be relative to the project, which will work out alright.

0 Likes

#6

If the files in the project could be made relative (or have a flag that turns on this setting) to the location of the project file, that would solve 99% of my personal headaches with the project structure.

0 Likes

#7

[quote=“ToddFiske”]Sublime Text stores the list of projects in \Data\Settings\Session.sublime_session, in a key at the end of the file called “workspaces”, relative to your user data area. The exact location depends on your OS and whether you use the portable version or the full installer.

This is a JSON file which you can edit (with another text editor when Sublime Text is not open) to change project files paths, the order of projects, delete unused projects, etc. Make sure to keep the same syntax, particularly the commas at the end of each item except the last one. It may be possible to edit it from Sublime, but that may produce unpleasing results. =)[/quote]

It worked perfectly, thank you!

0 Likes

#8

The reply above which pointed me to the Session.sublime_session file was great, but for me (a Windows 8 user) it was not to be easily found.

You have to open file explorer, click on the View menu and select ‘Hidden items’ in the Show/Hide ribbon section.

Then go to your user directory, which is usually *c:\users{{username}}*

Within there go to (the hidden directory) AppData\Roaming\Sublime Text 3\Local

Within there will be all of your Sublime user files, including Session.sublime_session.

Editing this file was the first time I’ve seen Notepad in a looonng time.

0 Likes

#9

One more thing. Backup the Session.sublime_session file before you edit. I didn’t, Sublime didn’t like my edit. So he blissfully went ahead and deleted my current Session file and recreated a new, pristine version.

Luckily I didn’t lose any packages or preferences, but I had to rebuild my project and workspace files.

And - I found out Windows 8 File Restore doesn’t backup your users…\AppData directory. Good to know I guess.

0 Likes

#10

Just because may be of your interest: If you don’t rely too much in project settings and only use project files to switch folders, I’ll suggest to try the package “SidebarFolders” it keeps an automated list of folders and provides handy main menu bar switching without the need to keep saving and tracking sublime-project files.

0 Likes