Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit daeddce

Browse files
committed
naive check of sequences in filename during path_from_data
1 parent e92c682 commit daeddce

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

avalon/pipeline.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,23 @@ def path_from_data():
13401340
if os.path.exists(path):
13411341
return os.path.normpath(path)
13421342

1343+
dir_path, file_name = os.path.split(path)
1344+
base_name, ext = os.path.splitext(file_name)
1345+
file_name_items = None
1346+
if "#" in base_name:
1347+
file_name_items = [part for part in base_name.split("#") if part]
1348+
elif "%" in base_name:
1349+
file_name_items = base_name.split("%")
1350+
1351+
if not file_name_items:
1352+
return
1353+
1354+
filename_start = file_name_items[0]
1355+
1356+
for _file in os.listdir(dir_path):
1357+
if _file.startswith(filename_start) and _file.endswith(ext):
1358+
return os.path.normpath(path)
1359+
13431360
return (
13441361
path_from_represenation() or
13451362
path_from_config() or

0 commit comments

Comments
 (0)