File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,20 @@ def top_path(path):
89
89
return path .root or path .drive
90
90
91
91
92
+ def full_norm_path (path ):
93
+ """Expand paths in all possible ways"""
94
+ return os .path .normpath (os .path .realpath (os .path .abspath (os .path .expanduser (os .path .expandvars (path .strip ())))))
95
+
96
+
92
97
@lru_cache (maxsize = 256 )
93
98
def walk_up (path , filenames , top ):
94
99
"""Look for "filenames" walking up in parent paths of "path"
95
100
but limited only to "top" path
96
101
"""
97
- if path == top :
102
+ if full_norm_path ( path ) == full_norm_path ( top ) :
98
103
return None
99
104
for filename in filenames :
100
105
path_filename = os .path .join (path , filename )
101
- if os .path .isfile (path_filename ):
106
+ if os .path .isfile (full_norm_path ( path_filename ) ):
102
107
return path_filename
103
108
return walk_up (os .path .dirname (path ), filenames , top )
You can’t perform that action at this time.
0 commit comments