diff --git a/client/ayon_core/plugins/publish/integrate_hero_version.py b/client/ayon_core/plugins/publish/integrate_hero_version.py index 8c36719b77..95b9f418f9 100644 --- a/client/ayon_core/plugins/publish/integrate_hero_version.py +++ b/client/ayon_core/plugins/publish/integrate_hero_version.py @@ -87,7 +87,9 @@ class IntegrateHeroVersion( ] # QUESTION/TODO this process should happen on server if crashed due to # permissions error on files (files were used or user didn't have perms) - # *but all other plugins must be sucessfully completed + # *but all other plugins must be successfully completed + + use_hardlinks = False def process(self, instance): if not self.is_active(instance.data): @@ -621,19 +623,21 @@ def copy_file(self, src_path, dst_path): src_path, dst_path )) - # First try hardlink and copy if paths are cross drive - try: - create_hard_link(src_path, dst_path) - # Return when successful - return - - except OSError as exc: - # re-raise exception if different than - # EXDEV - cross drive path - # EINVAL - wrong format, must be NTFS - self.log.debug("Hardlink failed with errno:'{}'".format(exc.errno)) - if exc.errno not in [errno.EXDEV, errno.EINVAL]: - raise + if self.use_hardlinks: + # First try hardlink and copy if paths are cross drive + try: + create_hard_link(src_path, dst_path) + # Return when successful + return + + except OSError as exc: + # re-raise exception if different than + # EXDEV - cross drive path + # EINVAL - wrong format, must be NTFS + self.log.debug( + "Hardlink failed with errno:'{}'".format(exc.errno)) + if exc.errno not in [errno.EXDEV, errno.EINVAL]: + raise shutil.copy(src_path, dst_path) diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index b37be1afe6..1b3d382f01 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -743,6 +743,14 @@ class IntegrateHeroVersionModel(BaseSettingsModel): optional: bool = SettingsField(False, title="Optional") active: bool = SettingsField(True, title="Active") families: list[str] = SettingsField(default_factory=list, title="Families") + use_hardlinks: bool = SettingsField( + False, title="Use Hardlinks", + description="When enabled first try to make a hardlink of the version " + "instead of a copy. This helps reduce disk usage, but may " + "create issues.\nFor example there are known issues on " + "Windows being unable to delete any of the hardlinks if " + "any of the links is in use creating issues with updating " + "hero versions.") class CleanUpModel(BaseSettingsModel): @@ -1136,7 +1144,8 @@ class PublishPuginsModel(BaseSettingsModel): "layout", "mayaScene", "simpleUnrealTexture" - ] + ], + "use_hardlinks": False }, "CleanUp": { "paterns": [],