Skip to content

Commit

Permalink
fix minor problem for switch project
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Apr 26, 2015
1 parent 4d35085 commit ba6b89d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/settings/toolingapi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"file_exclude_patterns": [
// "*.md",
// "*-history.*",
"*.*-meta.xml"
"*.*-meta.xml",
"*.sublime-project"
],

// Folders not shown in the sidebar and Command Palette
Expand Down
24 changes: 21 additions & 3 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2368,9 +2368,9 @@ def add_project_to_workspace(settings):
folder_path = _folder["path"]

# Parse windows path to AS-UNIX
if "\\" in folder_path :
if "\\" in folder_path:
folder_path = folder_path.replace("\\", "/")
if "\\" in workspace :
if "\\" in workspace:
workspace = workspace.replace("\\", "/")

if folder_path == workspace:
Expand Down Expand Up @@ -2400,7 +2400,25 @@ def add_project_to_workspace(settings):
project_data = sublime.active_window().project_data()
if not project_data: project_data = {}
folders = project_data.get("folders", [])
folders.append(switch_to_folder)

# If the workspace is already exist in project data,
# just update the patters, if not, add the workspace to it
for folder in folders:
folder_path = folder["path"]

# Parse windows path to AS-UNIX
if "\\" in folder_path:
folder_path = folder_path.replace("\\", "/")
if "\\" in workspace:
workspace = workspace.replace("\\", "/")

if folder["path"] == workspace:
folder["file_exclude_patterns"] = file_exclude_patterns;
folder["folder_exclude_patterns"] = folder_exclude_patterns
else:
folders.append(switch_to_folder)
else:
folders.append(switch_to_folder)
sublime.active_window().set_project_data({"folders": folders})

def focus_view(view):
Expand Down

0 comments on commit ba6b89d

Please sign in to comment.