Browse Source

change the way local projects are stored

master
Randy Lai 7 years ago
parent
commit
e0c33ca06a
  1. 18
      pm.py
  2. 13
      pm.sublime-settings

18
pm.py

@ -77,8 +77,8 @@ class Manager:
self.projects_dir = self.projects_fpath[0]
node = get_node()
if self.settings.get("use_machine_projects_dir", False):
self.projects_fpath = [os.path.join(self.projects_dir, node)] + self.projects_fpath
if self.settings.get("use_local_projects_dir", False):
self.projects_fpath = [self.projects_dir + " - " + node] + self.projects_fpath
self.projects_info = self.get_projects_info()
@ -92,10 +92,11 @@ class Manager:
pfiles.append(f)
pfiles.sort()
j.save(pfiles)
for f in os.listdir(pdir):
f = os.path.join(pdir, f)
if f.endswith(".sublime-project") and f not in pfiles:
pfiles.append(f)
for path, dirs, files in os.walk(pdir):
for f in files:
f = os.path.join(path, f)
if f.endswith(".sublime-project") and f not in pfiles:
pfiles.append(f)
for f in pfiles:
pname = os.path.basename(f).replace(".sublime-project", "")
pd = Jfile(f).load()
@ -285,9 +286,8 @@ class Manager:
# reload projects info
self.__init__(self.window)
self.open_in_new_window(new_project)
# make sure old workspace is deleted
os.unlink(wsfile)
# make sure old workspace is deleted
os.unlink(wsfile)
v = self.window.show_input_panel("New project name:", project, on_rename, None, None)
v.run_command("select_all")

13
pm.sublime-settings

@ -1,10 +1,11 @@
{
// a list of folders containing *.sublime-project files
// "projects_fpath": ["path/to/custom/projects_dir", ...]
// A list of folders containing *.sublime-project files
// "projects_fpath": ["path/to/custom/Projects", "another_path/to/Projects"]
// enable machine specific projects directory
// such a directory will be placed under projects_dir/machine_name
// machine_name is your computer hostname, you can get it by running
// Enable local projects directory, such a directory will be named
// after "Projects - computer_name". where computer_name is your computer hostname.
// It would be useful if Sublime Text settings are synced across different computers.
// To discover your computer hostname, run
// import sys; sys.modules['Project-Manager'].pm.get_node() in your sublime console
// "use_machine_projects_dir": true
// "use_local_projects_dir": true
}

Loading…
Cancel
Save