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: 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, 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( 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)