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