Adding our paths to sys.path start, not end

Otherwise things can conflict and we could end up loading the wrong module.
This commit is contained in:
Strahinja Val Markovic 2013-01-31 17:32:39 -08:00
parent c67658bbce
commit f671fe72b2
2 changed files with 4 additions and 4 deletions

View File

@ -75,9 +75,9 @@ class Flags( object ):
flags_module = self.flags_module_for_flags_module_file[
flags_module_file ]
except KeyError:
sys.path.append( _DirectoryOfThisScript() )
sys.path.insert( 0, _DirectoryOfThisScript() )
flags_module = imp.load_source( _RandomName(), flags_module_file )
del sys.path[ -1 ]
del sys.path[ 0 ]
self.flags_module_for_flags_module_file[
flags_module_file ] = flags_module

View File

@ -73,9 +73,9 @@ class YouCompleteMe( object ):
supported_filetypes = [ filetype ]
if os.path.exists( module_path ):
sys.path.append( os.path.dirname( module_path ) )
sys.path.insert( 0, os.path.dirname( module_path ) )
module = imp.load_source( filetype, module_path )
del sys.path[ -1 ]
del sys.path[ 0 ]
completer = module.GetCompleter()
if completer: