Add-on: use bat.bpathlib.make_absolute()
for making paths absolute
This should resolve the issue where on Windows file paths to a network share would be converted to UNC notation (and thus loose their drive letter).
This commit is contained in:
parent
d4dfa2d071
commit
fb5501028d
@ -2,10 +2,12 @@
|
||||
from pathlib import Path, PurePosixPath
|
||||
from typing import TYPE_CHECKING, Optional, Union
|
||||
import platform
|
||||
import logging
|
||||
|
||||
import bpy
|
||||
|
||||
from .job_types_propgroup import JobTypePropertyGroup
|
||||
from .bat.submodules import bpathlib
|
||||
from . import preferences
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -26,6 +28,7 @@ else:
|
||||
# it'll be set to the path of the BAT-packed blend file.
|
||||
BLENDFILE_SETTING_KEY = "blendfile"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def job_for_scene(scene: bpy.types.Scene) -> Optional[_SubmittedJob]:
|
||||
from flamenco.manager.models import SubmittedJob, JobMetadata
|
||||
@ -101,6 +104,11 @@ def is_file_inside_job_storage(context: bpy.types.Context, blendfile: Path) -> b
|
||||
|
||||
prefs = preferences.get(context)
|
||||
job_storage = Path(prefs.job_storage).absolute().resolve()
|
||||
|
||||
log.info("Checking whether the file is already inside the job storage")
|
||||
log.info(" file : %s", blendfile)
|
||||
log.info(" storage: %s", job_storage)
|
||||
|
||||
try:
|
||||
blendfile.relative_to(job_storage)
|
||||
except ValueError:
|
||||
|
@ -11,6 +11,7 @@ import bpy
|
||||
|
||||
from . import job_types, job_submission, preferences
|
||||
from .job_types_propgroup import JobTypePropertyGroup
|
||||
from .bat.submodules import bpathlib
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .bat.interface import (
|
||||
@ -242,8 +243,10 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator):
|
||||
self.blendfile_on_farm = None
|
||||
self._bat_pack_shaman(context, blendfile)
|
||||
elif job_submission.is_file_inside_job_storage(context, blendfile):
|
||||
self.log.info("File is already in job storage location, submitting it as-is")
|
||||
self._use_blendfile_directly(context, blendfile)
|
||||
else:
|
||||
self.log.info("File is not already in job storage location, copying it there")
|
||||
self.blendfile_on_farm = self._bat_pack_filesystem(context, blendfile)
|
||||
|
||||
context.window_manager.modal_handler_add(self)
|
||||
@ -363,7 +366,7 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator):
|
||||
|
||||
# The blend file is contained in the job storage path, no need to
|
||||
# copy anything.
|
||||
self.blendfile_on_farm = PurePosixPath(blendfile.absolute().resolve().as_posix())
|
||||
self.blendfile_on_farm = bpathlib.make_absolute(blendfile)
|
||||
self._submit_job(context)
|
||||
|
||||
def _submit_job(self, context: bpy.types.Context) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user