From da9f8f930a5db729e5e43e9fb640bdd048621f8f Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 30 Jan 2025 01:15:53 +0100 Subject: [PATCH 1/4] Support integrating a folder files for a representation --- client/ayon_core/lib/file_transaction.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/lib/file_transaction.py b/client/ayon_core/lib/file_transaction.py index a502403958..6d5eaa6219 100644 --- a/client/ayon_core/lib/file_transaction.py +++ b/client/ayon_core/lib/file_transaction.py @@ -1,5 +1,6 @@ import os import logging +import shutil import sys import errno @@ -135,7 +136,10 @@ def process(self): self._create_folder_for_file(dst) - if opts["mode"] == self.MODE_COPY: + if os.path.isdir(src): + self.log.debug(f"Copying directory ... {src} -> {dst}") + shutil.copytree(src, dst) + elif opts["mode"] == self.MODE_COPY: self.log.debug("Copying file ... {} -> {}".format(src, dst)) copyfile(src, dst) elif opts["mode"] == self.MODE_HARDLINK: From 90fa5ff804da15e8e7eb24a6e11d5a740103cf3c Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 30 Jan 2025 01:18:54 +0100 Subject: [PATCH 2/4] Support "Copy & Open" for published workfiles that are actually directories --- client/ayon_core/tools/workfiles/control.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/workfiles/control.py b/client/ayon_core/tools/workfiles/control.py index ca97015eea..3c285d9f4e 100644 --- a/client/ayon_core/tools/workfiles/control.py +++ b/client/ayon_core/tools/workfiles/control.py @@ -742,7 +742,11 @@ def _save_as_workfile( # Save workfile dst_filepath = os.path.join(workdir, filename) if src_filepath: - shutil.copyfile(src_filepath, dst_filepath) + # Support published workfile representations that may be folders + if os.path.isdir(src_filepath): + shutil.copytree(src_filepath, dst_filepath) + else: + shutil.copyfile(src_filepath, dst_filepath) self._host_open_workfile(dst_filepath) else: self._host_save_workfile(dst_filepath) From 4ff48ef882cfcdb2ae11faeb13f17e89e7208b3e Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 30 Jan 2025 01:44:39 +0100 Subject: [PATCH 3/4] Add folder support to Hero version integrator --- client/ayon_core/plugins/publish/integrate_hero_version.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/ayon_core/plugins/publish/integrate_hero_version.py b/client/ayon_core/plugins/publish/integrate_hero_version.py index 2163596864..4dccae0065 100644 --- a/client/ayon_core/plugins/publish/integrate_hero_version.py +++ b/client/ayon_core/plugins/publish/integrate_hero_version.py @@ -622,6 +622,13 @@ def copy_file(self, src_path, dst_path): self.log.debug("Folder already exists: \"{}\"".format(dirname)) + if os.path.isdir(src_path): + # Support representations that are directories + self.log.debug( + f"Copying directory \"{src_path}\" to \"{dst_path}\"") + shutil.copytree(src_path, dst_path) + return + if self.use_hardlinks: # First try hardlink and copy if paths are cross drive self.log.debug("Hardlinking file \"{}\" to \"{}\"".format( From 82a5e0416629308d41a7a040ede2f01f151e3f51 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 30 Jan 2025 01:48:42 +0100 Subject: [PATCH 4/4] Support representation files as folders in delivery tool --- client/ayon_core/pipeline/delivery.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/ayon_core/pipeline/delivery.py b/client/ayon_core/pipeline/delivery.py index 55c840f3a5..8f2627c47c 100644 --- a/client/ayon_core/pipeline/delivery.py +++ b/client/ayon_core/pipeline/delivery.py @@ -27,6 +27,12 @@ def _copy_file(src_path, dst_path): if os.path.exists(dst_path): return + + if os.path.isdir(src_path): + # Support representations that are directories + shutil.copytree(src_path, dst_path) + return + try: create_hard_link( src_path,