Browse Source

loader: move exists check after sys.path check (as exists is a more expensive call)

toddw 10 years ago
parent
commit
fbd89d36dd
1 changed files with 2 additions and 2 deletions
  1. 2 2
      xpcom/server/loader.py

+ 2 - 2
xpcom/server/loader.py

@@ -235,7 +235,7 @@ class ModuleLoader:
         for extDir in extDirs:
             for pylibName in ("pylib" + pyverstr, "pylib"):
                 pylibPath = join(extDir, pylibName)
-                if exists(pylibPath) and pylibPath not in sys.path:
+                if pylibPath not in sys.path and exists(pylibPath):
                     if verbose:
                         print "pyXPCOMExtensionHelper:: Adding pylib to sys.path:" \
                               " %r" % (pylibPath, )
@@ -245,7 +245,7 @@ class ModuleLoader:
                 if exists(platformPylibPath):
                     for platform_name in self._getPossiblePlatformNames():
                         pylibPath = join(platformPylibPath, platform_name, pylibName)
-                        if exists(pylibPath) and pylibPath not in sys.path:
+                        if pylibPath not in sys.path and exists(pylibPath):
                             if verbose:
                                 print "pyXPCOMExtensionHelper:: Adding pylib to sys.path:" \
                                       " %r" % (pylibPath, )