Skip to content

Commit d25345a

Browse files
authored
Merge pull request #701 from simvue-io/wk9874/680_toml_finding
Hotfix: Finding toml files
2 parents 5a94ff9 + 7f48657 commit d25345a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

simvue/utilities.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)