mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
use create_hard_link instead of filelink
This commit is contained in:
parent
8088534caa
commit
c57fc03916
3 changed files with 10 additions and 9 deletions
|
|
@ -71,15 +71,14 @@ def path_from_representation(representation, anatomy):
|
|||
|
||||
def copy_file(src_path, dst_path):
|
||||
"""Hardlink file if possible(to save space), copy if not"""
|
||||
from avalon.vendor import filelink # safer importing
|
||||
from openpype.lib import create_hard_link # safer importing
|
||||
|
||||
if os.path.exists(dst_path):
|
||||
return
|
||||
try:
|
||||
filelink.create(
|
||||
create_hard_link(
|
||||
src_path,
|
||||
dst_path,
|
||||
filelink.HARDLINK
|
||||
dst_path
|
||||
)
|
||||
except OSError:
|
||||
shutil.copyfile(src_path, dst_path)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import shutil
|
|||
from pymongo import InsertOne, ReplaceOne
|
||||
import pyblish.api
|
||||
from avalon import api, io, schema
|
||||
from avalon.vendor import filelink
|
||||
from openpype.lib import create_hard_link
|
||||
|
||||
|
||||
class IntegrateHeroVersion(pyblish.api.InstancePlugin):
|
||||
|
|
@ -518,7 +518,7 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
|
|||
|
||||
# First try hardlink and copy if paths are cross drive
|
||||
try:
|
||||
filelink.create(src_path, dst_path, filelink.HARDLINK)
|
||||
create_hard_link(src_path, dst_path)
|
||||
# Return when successful
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ from pymongo import DeleteOne, InsertOne
|
|||
import pyblish.api
|
||||
from avalon import io
|
||||
from avalon.api import format_template_with_optional_keys
|
||||
from avalon.vendor import filelink
|
||||
import openpype.api
|
||||
from datetime import datetime
|
||||
# from pype.modules import ModulesManager
|
||||
from openpype.lib.profiles_filtering import filter_profiles
|
||||
from openpype.lib import prepare_template_data
|
||||
from openpype.lib import (
|
||||
prepare_template_data,
|
||||
create_hard_link
|
||||
)
|
||||
|
||||
# this is needed until speedcopy for linux is fixed
|
||||
if sys.platform == "win32":
|
||||
|
|
@ -730,7 +732,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
self.log.critical("An unexpected error occurred.")
|
||||
six.reraise(*sys.exc_info())
|
||||
|
||||
filelink.create(src, dst, filelink.HARDLINK)
|
||||
create_hard_link(src, dst)
|
||||
|
||||
def get_subset(self, asset, instance):
|
||||
subset_name = instance.data["subset"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue