Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

stable paths: add is_on_fixed_drive method

Changeset e63813991225

Parent a033dc7d63cd

by Steve Borho

Changes to one file · Browse files at e63813991225 Showing diff from parent a033dc7d63cd Diff from another changeset...

 
47
48
49
50
 
 
51
52
53
 
72
73
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
76
77
 
112
113
114
 
 
 
 
 
47
48
49
 
50
51
52
53
54
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
127
128
129
130
131
132
133
@@ -47,7 +47,8 @@
 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" @@ -72,6 +73,20 @@
  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, ...), @@ -112,3 +127,7 @@
  or False if <drive> is not a network drive   """   return False + + def is_on_fixed_drive(path): + return True +