Browse Source

expand path when adding project

master 0.7.10
Randy Lai 4 years ago
parent
commit
2819e349f2
  1. 21
      project_manager.py

21
project_manager.py

@ -281,19 +281,18 @@ class Manager:
def add_project(self):
def add_callback(project):
pd = self.window.project_data()
pf = self.window.project_file_name()
pfile = os.path.join(self.primary_dir, '%s.sublime-project' % project)
if "folders" in pd:
for folder in pd["folders"]:
if "path" in folder:
path = folder["path"]
if sublime.platform() == "windows":
folder["path"] = expand_path(path, relative_to=pf)
else:
folder["path"] = pretty_path(
expand_path(path, relative_to=pf))
# prettify paths
if sublime.platform() == "windows":
# on windows, sublime-project doesn't recognize "~"
# any hacks?
pass
else:
if "folders" in pd:
for i, folder in enumerate(pd["folders"]):
if "path" in folder:
path = pd["folders"][i]["path"]
pd["folders"][i]["path"] = pretty_path(path)
if pd:
JsonFile(pfile).save(pd)
else:

Loading…
Cancel
Save