Skip to content

Commit cb40fa7

Browse files
committed
Resolve relative paths to absolute paths
1 parent 247689e commit cb40fa7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

client/ayon_cinema4d/plugins/publish/collect_render.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def files_resolver(
201201
"""Return filepaths for all frames with given token path and
202202
layer names."""
203203
files: list[str] = []
204+
token_path = self._abspath(doc, token_path)
204205
for frame in range(
205206
render_instance.frameStartHandle,
206207
render_instance.frameEndHandle + 1,
@@ -288,7 +289,6 @@ def _collect_multipass(
288289
render_data,
289290
files_resolver
290291
) -> dict[str, list[str]]:
291-
292292
multipass_token_path: str = render_data[c4d.RDATA_MULTIPASS_FILENAME]
293293
self.log.debug(
294294
f"Collected Multi-Pass Filepath: {multipass_token_path}"
@@ -392,3 +392,15 @@ def _collect_redshift_aovs(
392392

393393
products[aov_name] = files
394394
return products
395+
396+
def _abspath(self, doc, path: str) -> str:
397+
"""Return absolute path from possibly relative path."""
398+
if os.path.isabs(path):
399+
return path
400+
401+
project_folder: str = doc.GetDocumentPath()
402+
abs_path: str = os.path.normpath(os.path.join(project_folder, path))
403+
self.log.debug(
404+
f"Resolved relative path '{path}' to absolute path '{abs_path}'"
405+
)
406+
return abs_path

0 commit comments

Comments
 (0)