From 199c742f52eca424c900790c4b99231995374e31 Mon Sep 17 00:00:00 2001 From: jbergknoff Date: Sat, 8 Feb 2014 16:59:30 -0800 Subject: [PATCH 1/2] fixing crash when working directory ceases to exist --- sublime_files.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sublime_files.py b/sublime_files.py index 78ee9c1..731f393 100644 --- a/sublime_files.py +++ b/sublime_files.py @@ -13,10 +13,14 @@ class SublimeFilesCommand(sublime_plugin.WindowCommand): def getcwd(self): - if running_in_st3(): - return os.getcwd() - else: - return os.getcwdu() + try: + if running_in_st3(): + return os.getcwd() + else: + return os.getcwdu() + except OSError: + os.chdir(os.getenv(self.home)) + return self.getcwd() def show_quick_panel(self, elements, on_selection, params): sublime.set_timeout(lambda: self.window.show_quick_panel(elements, on_selection, params), 10) From 539d4babf8b4266393f9d1610a88858eb07b82f3 Mon Sep 17 00:00:00 2001 From: petroosh Date: Sat, 16 Aug 2014 13:24:22 -0400 Subject: [PATCH 2/2] Fixed getting the wrong executable in ST3 on Linux --- sublime_files.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sublime_files.py b/sublime_files.py index 731f393..feb4c57 100644 --- a/sublime_files.py +++ b/sublime_files.py @@ -217,7 +217,10 @@ def get_sublime_path(): else: return '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl' elif sublime.platform() == 'linux': - return open('/proc/self/cmdline').read().split(chr(0))[0] + if running_in_st3(): + return open('/proc/' + str(os.getppid()) + '/cmdline').read().split(chr(0))[0] + else: + return open('/proc/self/cmdline').read().split(chr(0))[0] else: if running_in_st3(): return os.path.join(sys.path[0], 'sublime_text.exe')