Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Additional change for ST3 #24

Closed
wants to merge 2 commits into from

2 participants

@tollus

It seems you have to force encode/decode to utf8 in some cases. Tested in ST2 (2220) and ST3 (3012).

@vishr vishr referenced this pull request from a commit
Vishal Rana Added support for ST3, fixed #22 #23 #24. 9968cde
@vishr
Owner

@tollus Can you please verify the new changes?

@tollus

Looks good to me! Thanks for that update, and nice cleanup on the code too.

@tollus tollus closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2013
  1. @tollus
Commits on Feb 26, 2013
  1. @tollus

    forgot to remove debug print

    tollus authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 7 deletions.
  1. +10 −7 history.py
View
17 history.py
@@ -44,14 +44,15 @@ def show_diff(window, from_file, to_file):
def get_filedir(file_path):
- file_dir = os.path.dirname(file_path)
+ file_dir = os.path.dirname(file_path).decode("utf-8")
if platform.system() == "Windows":
- if file_dir.find("\\") == 0:
+ if file_dir.find(os.sep) == 0:
file_dir = file_dir[2:] # Strip the network \\ starting path
- if file_dir.find(":") == 1:
- file_dir = file_dir.replace(":", "", 1)
+ if file_dir.find(':') == 1:
+ file_dir = file_dir.replace(':', '', 1)
else:
file_dir = file_dir[file_dir.find(os.sep) + 1:] # Trim the root
+
return os.path.join(HISTORY_PATH, file_dir)
@@ -68,7 +69,7 @@ def run(file_path):
return
# Get history directory
- file_name = os.path.basename(file_path)
+ file_name = os.path.basename(file_path).decode("utf-8")
history_dir = get_filedir(file_path)
if not os.path.exists(history_dir):
# Create directory structure
@@ -85,8 +86,10 @@ def run(file_path):
return
# Store history
- shutil.copyfile(file_path, os.path.join(history_dir, "{0}.{1}".
- format(dt.now().strftime("%b.%d.%Y_%H.%M.%S"), file_name)))
+ copy_path = os.path.join(history_dir, "{0}.{1}".
+ format(dt.now().strftime("%b.%d.%Y_%H.%M.%S"), file_name))
+ #print(copy_path)
+ shutil.copyfile(file_path.decode("utf-8"), copy_path)
# Remove old files
for file in history_files[HISTORY_LIMIT - 1:]: # -1 as we just added a new file
Something went wrong with that request. Please try again.