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