From e91efcb8a34b27c5088096350e7b3a40bdf58e16 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 26 Jan 2021 15:41:16 +0100 Subject: [PATCH] Fix proper escaping for executable - Photoshop Plus escaping of workfile path --- pype/hooks/photoshop/pre_launch_args.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pype/hooks/photoshop/pre_launch_args.py b/pype/hooks/photoshop/pre_launch_args.py index b13e7d1e0f..6bd40eb2e1 100644 --- a/pype/hooks/photoshop/pre_launch_args.py +++ b/pype/hooks/photoshop/pre_launch_args.py @@ -20,13 +20,20 @@ class PhotoshopPrelaunchHook(PreLaunchHook): while self.launch_context.launch_args: remainders.append(self.launch_context.launch_args.pop(0)) + workfile_path = self.data["last_workfile_path"] + if not os.path.exists(workfile_path): + workfile_path = "" + new_launch_args = [ self.python_executable(), "-c", ( "import avalon.photoshop;" - "avalon.photoshop.launch(\"{}\")" - ).format(photoshop_executable) + "avalon.photoshop.launch(\"{}\", \"{}\")" + ).format( + photoshop_executable.replace("\\", "\\\\"), + workfile_path.replace("\\", "\\\\") + ) ] # Append as whole list as these areguments should not be separated