Commits

Steve Borho  committed e638139

paths: add is_on_fixed_drive method

  • Participants
  • Parent commits a033dc7
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/util/paths.py

 if os.name == 'nt':
     import _winreg
     import win32net
-    USE_OK  = 0     # network drive status
+    import win32api
+    import win32file
 
     def find_in_path(pgmname):
         "return first executable found in search path"
                 pass
         return os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
 
+    def is_on_fixed_drive(path):
+        if hasattr(os.path, 'splitunc'):
+            unc, rest = os.path.splitunc(drive)
+            if unc:
+                # All UNC paths (\\host\mount) are considered not-fixed
+                return False
+        drive, remain = os.path.splitdrive(path)
+        if drive:
+            return win32file.GetDriveType(drive) == win32file.DRIVE_FIXED
+        else:
+            return False
+
+    USE_OK  = 0     # network drive status
+
     def netdrive_status(drive):
         """
         return True if a network drive is accessible (connected, ...),
         or False if <drive> is not a network drive
         """
         return False
+
+    def is_on_fixed_drive(path):
+        return True
+