Skip to content

Commit

Permalink
Fixed sublime under Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Oct 7, 2014
1 parent 4c74621 commit 81ab99f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def getSublimeTextPaths():
if system == 'Windows':
for folder in ["Program Files", "Program Files (x86)"]:
for version in [2, 3]:
paths.append("C:\\{}\\Sublime Text\\{}\\sublime_text.exe".format(folder, version))
paths.append("C:\\{}\\Sublime Text {}".format(folder, version))
paths += os.environ['PATH'].split(os.pathsep)
return [ paths, "sublime_text.exe" if system == 'Windows' else "subl" ]

Expand Down Expand Up @@ -522,11 +522,14 @@ def editUpdate(args, stationID):
(paths, binary) = getSublimeTextPaths()
for path in paths:
candidate = os.path.join(path, binary)
if pathlib.Path(candidate).exists():
editor = candidate
break
try:
if pathlib.Path(candidate).exists():
editor = candidate
break
except OSError:
pass
else:
print("ERROR: --sublime specified but could not find your Sublime Text installation. Either specify the path to your editor with --editor or set the SUBLIME_EDITOR environment variable.")
raise CommandLineError("ERROR: --sublime specified but could not find your Sublime Text installation. Either specify the path to your editor with --editor or set the SUBLIME_EDITOR environment variable.")
editorArgs += [ "--wait" ]
elif args.notepad:
if args.debug: print("# Notepad mode")
Expand Down Expand Up @@ -894,4 +897,4 @@ def main():
print("%s: %s" % (sys.argv[0], str(e)))
if mfd:
mfd.finish()
y

0 comments on commit 81ab99f

Please sign in to comment.