File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,17 @@ def find_first_instance_of_file(
5050 if isinstance (file_names , str ):
5151 file_names = [file_names ]
5252
53- for root , _ , files in os . walk ( os . getcwd (), topdown = False ) :
54- for file_name in file_names :
55- if file_name in files :
56- return pathlib . Path ( root ). joinpath ( file_name )
53+ for file_name in file_names :
54+ _user_file = pathlib . Path . cwd (). joinpath ( file_name )
55+ if _user_file . exists () :
56+ return _user_file
5757
5858 # If the user is running on different mounted volume or outside
5959 # of their user space then the above will not return the file
6060 if check_user_space :
6161 for file_name in file_names :
62- if os .path .exists (_user_file := pathlib .Path .home ().joinpath (file_name )):
62+ _user_file = pathlib .Path .home ().joinpath (file_name )
63+ if _user_file .exists ():
6364 return _user_file
6465
6566 return None
You can’t perform that action at this time.
0 commit comments