From 1de398a3775063f52b7f287b603a1e3ca9e8fab5 Mon Sep 17 00:00:00 2001 From: Albert Tang Date: Sat, 12 Aug 2023 13:24:05 -0500 Subject: [PATCH] xcode: Wrap custom target output paths in quotes Without this, any build directory with a space in it was enough to make Xcode fail to open the project due to parsing errors. --- mesonbuild/backend/xcodebackend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index 5088fe054..e2b8b9985 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -883,7 +883,7 @@ class XCodeBackend(backends.Backend): custom_dict.add_item('isa', 'PBXFileReference') custom_dict.add_item('explicitFileType', '"' + typestr + '"') custom_dict.add_item('name', o) - custom_dict.add_item('path', os.path.join(self.src_to_build, o)) + custom_dict.add_item('path', f'"{os.path.join(self.src_to_build, o)}"') custom_dict.add_item('refType', 0) custom_dict.add_item('sourceTree', 'SOURCE_ROOT') objects_dict.add_item(self.custom_target_output_fileref[o], custom_dict) @@ -1242,7 +1242,7 @@ class XCodeBackend(backends.Backend): custom_dict.add_item('name', '"Generate {}."'.format(ofilenames[0])) custom_dict.add_item('outputPaths', outarray) for o in ofilenames: - outarray.add_item(os.path.join(self.environment.get_build_dir(), o)) + outarray.add_item(f'"{os.path.join(self.environment.get_build_dir(), o)}"') custom_dict.add_item('runOnlyForDeploymentPostprocessing', 0) custom_dict.add_item('shellPath', '/bin/sh') workdir = self.environment.get_build_dir() @@ -1290,7 +1290,7 @@ class XCodeBackend(backends.Backend): outarray = PbxArray() gen_dict.add_item('outputPaths', outarray) for of in ofile_abs: - outarray.add_item(of) + outarray.add_item(f'"{of}"') for i in infilelist: # This might be needed to be added to inputPaths. It's not done yet as it is # unclear whether it is necessary, what actually happens when it is defined