Show More
@@ -102,10 +102,22 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 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 | |||
|
112 | ||||
105 | # check UF_HIDDEN on any location up to root |
|
113 | # check UF_HIDDEN on any location up to root | |
106 | path = abs_path |
|
114 | path = abs_path | |
107 | while path and path.startswith(abs_root) and path != abs_root: |
|
115 | while path and path.startswith(abs_root) and path != abs_root: | |
108 | st = os.stat(path) |
|
116 | try: | |
|
117 | # may fail on Windows junctions | |||
|
118 | st = os.stat(path) | |||
|
119 | except OSError: | |||
|
120 | return True | |||
109 | if getattr(st, 'st_flags', 0) & UF_HIDDEN: |
|
121 | if getattr(st, 'st_flags', 0) & UF_HIDDEN: | |
110 | return True |
|
122 | return True | |
111 | path = os.path.dirname(path) |
|
123 | path = os.path.dirname(path) |
General Comments 0
You need to be logged in to leave comments.
Login now