From 48a8d7d5fd5eb9000e1be21ae38fb5bc7eb9867a Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Wed, 5 Nov 2014 17:34:07 -0500 Subject: [PATCH 1/8] Fix sublime-menu --- Main.sublime-menu | 133 ++++++++++++++++++---------------------------- 1 file changed, 53 insertions(+), 80 deletions(-) diff --git a/Main.sublime-menu b/Main.sublime-menu index 31c862a..cfec6f0 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -1,82 +1,55 @@ [ - { - "caption": "Preferences", - "mnemonic": "n", - "id": "preferences", - "children": - [ - { - "caption": "Package Settings", - "mnemonic": "P", - "id": "package-settings", - "children": - [ - { - "caption": "Package Syncing", - "children": - [ - { - "caption": "Settings – Default", - "command": "open_file", "args": { "file": "${packages}/Package Syncing/Package Syncing.sublime-settings" } - }, - { - "caption": "Settings – User", - "command": "open_file", "args": { "file": "${packages}/User/Package Syncing.sublime-settings" } - } - ] - } - ] - } - ] - }, - { - "id": "tools", - "children": - [ - { - "caption": "Packages", - "id": "packages", - "children": - [ - { - "caption": "Package Syncing", - "children": - [ - { - "caption": "Enable Syncing", - "command": "pkg_sync_enable" - }, - { - "caption": "Disable Syncing", - "command": "pkg_sync_disable" - }, - { "caption": "-" }, - { - "caption": "Define Sync Folder", - "command": "pkg_sync_folder" - }, - { "caption": "-" }, - { - "caption": "Push Settings", - "command": "pkg_sync", "args": {"mode": ["push"]} - }, - { - "caption": "Pull Settings", - "command": "pkg_sync", "args": {"mode": ["pull"]} - }, - { "caption": "-" }, - { - "caption": "Settings – Default", - "command": "open_file", "args": { "file": "${packages}/Package Syncing/Package Syncing.sublime-settings" } - }, - { - "caption": "Settings – User", - "command": "open_file", "args": { "file": "${packages}/User/Package Syncing.sublime-settings" } - } - ] - } - ] - } - ] - } + { + "caption": "Preferences", + "mnemonic": "n", + "id": "preferences", + "children": + [ + { + "caption": "Package Settings", + "mnemonic": "P", + "id": "package-settings", + "children": + [ + { + "caption": "StataEditor", + "children": + [ + { + "caption": "README", + "command": "open_file", + "args": {"file": "${packages}/StataEditor/Readme.md"} + }, + { + "caption": "-" + }, + { + "caption": "Settings – Default", + "command": "open_file", + "args": {"file": "${packages}/StataEditor/StataEditor.sublime-settings"} + }, + { + "caption": "Settings – User", + "command": "open_file", + "args": {"file": "${packages}/User/StataEditor.sublime-settings"} + }, + { + "caption": "-" + }, + { + "caption": "Key Bindings – Default", + "command": "open_file", + "args": {"file": "${packages}/StataEditor/Default (Windows).sublime-keymap"} + }, + { + "caption": "Key Bindings – User", + "command": "open_file", + "args": {"file": "${packages}/User/Default (Windows).sublime-keymap"} + } + ] + } + ] + } + ] + } ] From 3cc2b518047b7d46b9b3680f3b924498ff2c2358 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Wed, 5 Nov 2014 17:47:33 -0500 Subject: [PATCH 2/8] bugfix --- Main.sublime-menu | 62 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/Main.sublime-menu b/Main.sublime-menu index cfec6f0..2973658 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -1,4 +1,45 @@ [ + { + "id": "tools", + "children": + [ + { + "caption": "Packages", + "id": "packages", + "children": + [ + { + "caption": "Package Syncing", + "children": + [ + { + "caption": "Enable Syncing", + "command": "pkg_sync_enable" + }, + { + "caption": "Disable Syncing", + "command": "pkg_sync_disable" + }, + { "caption": "-" }, + { + "caption": "Define Sync Folder", + "command": "pkg_sync_folder" + }, + { "caption": "-" }, + { + "caption": "Push Settings", + "command": "pkg_sync", "args": {"mode": ["push"]} + }, + { + "caption": "Pull Settings", + "command": "pkg_sync", "args": {"mode": ["pull"]} + } + ] + } + ] + } + ] + }, { "caption": "Preferences", "mnemonic": "n", @@ -12,13 +53,13 @@ "children": [ { - "caption": "StataEditor", + "caption": "Package Syncing", "children": [ { "caption": "README", "command": "open_file", - "args": {"file": "${packages}/StataEditor/Readme.md"} + "args": {"file": "${file_path}/Readme.md"} }, { "caption": "-" @@ -26,25 +67,12 @@ { "caption": "Settings – Default", "command": "open_file", - "args": {"file": "${packages}/StataEditor/StataEditor.sublime-settings"} + "args": { "file": "${file_path}/Package Syncing.sublime-settings" } }, { "caption": "Settings – User", "command": "open_file", - "args": {"file": "${packages}/User/StataEditor.sublime-settings"} - }, - { - "caption": "-" - }, - { - "caption": "Key Bindings – Default", - "command": "open_file", - "args": {"file": "${packages}/StataEditor/Default (Windows).sublime-keymap"} - }, - { - "caption": "Key Bindings – User", - "command": "open_file", - "args": {"file": "${packages}/User/Default (Windows).sublime-keymap"} + "args": { "file": "${packages}/User/Package Syncing.sublime-settings" } } ] } From 9edf71e54a951a078078a3ef2eddfb7fb112f68e Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Wed, 5 Nov 2014 17:57:15 -0500 Subject: [PATCH 3/8] bugfix --- Main.sublime-menu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Main.sublime-menu b/Main.sublime-menu index 2973658..0c98b33 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -59,7 +59,7 @@ { "caption": "README", "command": "open_file", - "args": {"file": "${file_path}/Readme.md"} + "args": {"file": "${packages}/Package Syncing/Readme.md"} }, { "caption": "-" @@ -67,7 +67,7 @@ { "caption": "Settings – Default", "command": "open_file", - "args": { "file": "${file_path}/Package Syncing.sublime-settings" } + "args": { "file": "${packages}/Package Syncing/Package Syncing.sublime-settings" } }, { "caption": "Settings – User", From 74301050c62fccbf12236925cce7c4a578990cdf Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Sun, 9 Nov 2014 17:59:07 -0500 Subject: [PATCH 4/8] trying to detect bug in win7 systems Sometimes files get converted to lowercase --- package_syncing/thread.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package_syncing/thread.py b/package_syncing/thread.py index b0b22df..9ed7f90 100644 --- a/package_syncing/thread.py +++ b/package_syncing/thread.py @@ -175,7 +175,12 @@ def pull(self, item): last_remote_data = last_data.get("last_remote_data", {}) # Make target file path and directory - target = os.path.join(local_dir, item["key"]) + target_fn = item["key"] + if target_fn==target_fn.lower(): + sublime.error_message("The bug where files get copied lowercase just happened" ) + raise Exception + + target = os.path.join(local_dir, target_fn) target_dir = os.path.dirname(target) # Skip if file was just pushed From 044d4716f15defe8f91b5e777516a33193b5aa78 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Sun, 9 Nov 2014 18:14:40 -0500 Subject: [PATCH 5/8] finding bug --- package_syncing/thread.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package_syncing/thread.py b/package_syncing/thread.py index 9ed7f90..8c420d8 100644 --- a/package_syncing/thread.py +++ b/package_syncing/thread.py @@ -114,6 +114,11 @@ def find_files(self, path): [dir_names.remove(dir) for dir in dir_names if dir in dirs_to_ignore] for file_name in file_names: + + if file_name==file_name.lower(): + sublime.error_message("[Package Syncing] The bug where files get copied lowercase just happened" ) + raise Exception + full_path = os.path.join(root, file_name) rel_path = os.path.relpath(full_path, path) From 5c7415b87797fc487e997103b061063d701127a7 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Sun, 9 Nov 2014 18:18:45 -0500 Subject: [PATCH 6/8] bf --- package_syncing/thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_syncing/thread.py b/package_syncing/thread.py index 8c420d8..0d12b64 100644 --- a/package_syncing/thread.py +++ b/package_syncing/thread.py @@ -116,7 +116,7 @@ def find_files(self, path): for file_name in file_names: if file_name==file_name.lower(): - sublime.error_message("[Package Syncing] The bug where files get copied lowercase just happened" ) + sublime.error_message("[Package Syncing] The bug where files get copied lowercase just happened:" + filen_name) raise Exception full_path = os.path.join(root, file_name) From 8e79430ee723586d1562e0ed754ca3adbf0ea7c2 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Sun, 9 Nov 2014 19:12:16 -0500 Subject: [PATCH 7/8] bf --- package_syncing/thread.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/package_syncing/thread.py b/package_syncing/thread.py index 0d12b64..f190274 100644 --- a/package_syncing/thread.py +++ b/package_syncing/thread.py @@ -114,11 +114,7 @@ def find_files(self, path): [dir_names.remove(dir) for dir in dir_names if dir in dirs_to_ignore] for file_name in file_names: - - if file_name==file_name.lower(): - sublime.error_message("[Package Syncing] The bug where files get copied lowercase just happened:" + filen_name) - raise Exception - + file_name = file_name.lower() # We can't use fn as a key if Dropbox autoconverts it to lowercase on Windows! full_path = os.path.join(root, file_name) rel_path = os.path.relpath(full_path, path) @@ -181,10 +177,6 @@ def pull(self, item): # Make target file path and directory target_fn = item["key"] - if target_fn==target_fn.lower(): - sublime.error_message("The bug where files get copied lowercase just happened" ) - raise Exception - target = os.path.join(local_dir, target_fn) target_dir = os.path.dirname(target) From 76acb7dd5bc6d775818d9f6d54e5a34c5a1d1cce Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Sun, 9 Nov 2014 19:20:11 -0500 Subject: [PATCH 8/8] bf --- package_syncing/thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_syncing/thread.py b/package_syncing/thread.py index f190274..02a22b8 100644 --- a/package_syncing/thread.py +++ b/package_syncing/thread.py @@ -115,8 +115,8 @@ def find_files(self, path): for file_name in file_names: file_name = file_name.lower() # We can't use fn as a key if Dropbox autoconverts it to lowercase on Windows! - full_path = os.path.join(root, file_name) - rel_path = os.path.relpath(full_path, path) + full_path = os.path.join(root, file_name).lower() + rel_path = os.path.relpath(full_path, path).lower() include_matches = [fnmatch.fnmatch(rel_path, p) for p in files_to_include] ignore_matches = [fnmatch.fnmatch(rel_path, p) for p in files_to_ignore]