Commits

Kay-Uwe (Kiwi) Lorenz committed ffdde68

switched back to getting project from auto save sessions

Comments (0)

Files changed (1)

     SUBLIME_DRV = re.compile('^/([A-Z])/')
 
     def get_active_project(self, window):
-        current_view = window.active_view()
 
-        current_file = ""
+        ses = self.get_session_file(auto=True)
+        if not ses:
+            sys.stderr.write("auto session file does not exist")
+            return ""
+            #window.ok_cancel_dialog("Auto Save Session File does not exist")
 
-        if current_view: current_file = current_view.file_name()
+        window_id = window.id()
+        for w in ses['windows']:
+            if w['window_id'] == window_id:
+                project = w['workspace_name']
+                if sublime.platform() == 'windows':
+                    project =  os.path.normpath(SUBLIME_DRV.sub('\\1:/', project))
+                return project
+    
+        sys.stderr.write("could not find window id in auto session file")
+        return ""
 
-        window.run_command('open_file', {'file': '${project}'})
-
-        project_view = window.active_view()
-        project = project_view.file_name()
-
-        if not project.endswith('.sublime-project'):
-            return None
-
-        if current_file == project:
-            if not current_file.endswith('.sublime-project'):
-                return None
-        else:
-            window.run_command('close_file')
-
-        return project
     
     def get_info(self, window):
         info = {}
 
         info['S'] = info['settings']
 
-
         return info
 
     def expand_patterns(self, obj, info):