Skip to content

Commit

Permalink
Allow datafile to be name only and not include subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
kjetilbjorke committed Oct 17, 2024
1 parent 3b2dc27 commit 6bcaa06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/fmu/sumo/sim2sumo/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ def find_datafiles(seedpoint=None):
full_path = (
cwd / sp if not sp.is_absolute() else sp
) # Make the path absolute
if full_path.is_file() and full_path.suffix in valid_filetypes:
# Add the file if it has a valid filetype
datafiles.append(full_path)
if full_path.suffix in valid_filetypes:
if full_path.is_file():
# Add the file if it has a valid filetype
datafiles.append(full_path)
else:
for filetype in valid_filetypes:
datafiles.extend([f for f in full_path.parent.rglob(f"{full_path.name}*{filetype}")])
else:
for filetype in valid_filetypes:
if not full_path.is_dir():
Expand Down

0 comments on commit 6bcaa06

Please sign in to comment.