##// END OF EJS Templates
only check listdir on dirs...
MinRK -
Show More
@@ -102,10 +102,12 b" def is_hidden(abs_path, abs_root=''):"
102 if any(part.startswith('.') for part in inside_root.split(os.sep)):
102 if any(part.startswith('.') for part in inside_root.split(os.sep)):
103 return True
103 return True
104
104
105 # check that path can be listed
105 # check that dirs can be listed
106 # may fail on Windows junctions or non-user-readable dirs
107 if os.path.isdir(abs_path):
106 try:
108 try:
107 os.listdir(abs_path)
109 os.listdir(abs_path)
108 except Exception:
110 except OSError:
109 return True
111 return True
110
112
111 # check UF_HIDDEN on any location up to root
113 # check UF_HIDDEN on any location up to root
@@ -114,7 +116,7 b" def is_hidden(abs_path, abs_root=''):"
114 try:
116 try:
115 # may fail on Windows junctions
117 # may fail on Windows junctions
116 st = os.stat(path)
118 st = os.stat(path)
117 except Exception:
119 except OSError:
118 return True
120 return True
119 if getattr(st, 'st_flags', 0) & UF_HIDDEN:
121 if getattr(st, 'st_flags', 0) & UF_HIDDEN:
120 return True
122 return True
General Comments 0
You need to be logged in to leave comments. Login now