diff --git a/python/completers/cpp/flags.py b/python/completers/cpp/flags.py index 9dc857c6..16b4c75d 100644 --- a/python/completers/cpp/flags.py +++ b/python/completers/cpp/flags.py @@ -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 diff --git a/python/ycm.py b/python/ycm.py index a787fa51..c29494a7 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -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: