Commits

pjv committed a95878d

add ST2_dir to get the system path to the directory of the packages directory
fixed bug that was not allowing plugin to switch syntax to python in the case of non-django python files

  • Participants
  • Parent commits 998c334

Comments (0)

Files changed (1)

File SetDjangoSyntax.py

 
 # requires Djaneiro [https://github.com/squ1b3r/Djaneiro]
 
+ST2_dir = os.path.dirname(os.path.dirname(os.getcwdu()))
 
 class SetDjangoSyntaxCommand(sublime_plugin.EventListener):
     """ Attempts to set Python Django Syntax when appropriate. """
             return
 
         if self.is_django():
+            self.set_syntax('Python Django', 'Djaneiro')
+            return
+        else:
+            self.set_syntax('Python', 'Python')
             return
 
 
     def is_django(self):
         if self.view.find('from django',0,sublime.IGNORECASE) > -1:
-            self.set_syntax('Python Django', 'Djaneiro')
             return True
         return False
 
             path = syntax
 
         new_syntax = 'Packages/' + path + '/' + syntax + '.tmLanguage'
-        if not os.path.exists(new_syntax):
+
+        if not os.path.exists(os.path.join(ST2_dir, new_syntax)):
             new_syntax = 'Packages/' + path + '/Syntaxes/' + syntax + '.tmLanguage'
         current_syntax = self.view.settings().get('syntax')