From 63e893d23d84c9bf65bad64fc359b9686eb19b4d Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 10 Jan 2024 09:52:33 -0800 Subject: [PATCH] Properly handle Xcode targets with spaces in their names (#42220) Summary: Properly handle targets with spaces in their names Use quotes around the argument to basename path. Ensures this succeeds when the Xcode target name has spaces. example: ```sh #!/bin/sh SOURCEMAP_FILE="ArchiveIntermediates/Jane Doe/IntermediateBuildFilesPath/Jane Doe.build/Release-iphoneos/JaneDoe.build/DerivedSources/main.jsbundle.map" BN_SOURCEMAP_FILE="$(basename $SOURCEMAP_FILE)" echo $BN_SOURCEMAP_FILE ``` output: ``` Jane Jane main.jsbundle.map ``` ```sh #!/bin/sh SOURCEMAP_FILE="ArchiveIntermediates/Jane Doe/IntermediateBuildFilesPath/Jane Doe.build/Release-iphoneos/JaneDoe.build/DerivedSources/main.jsbundle.map" BN_SOURCEMAP_FILE="$(basename "$SOURCEMAP_FILE")" echo $BN_SOURCEMAP_FILE ``` output: ``` main.jsbundle.map ``` ## Changelog: [iOS] [Fixed] - Fix support for SOURCEMAP_FILE path containing spaces ## Related https://github.com/facebook/react-native/pull/40937 Pull Request resolved: https://github.com/facebook/react-native/pull/42220 Reviewed By: christophpurrer Differential Revision: D52650491 Pulled By: arushikesarwani94 fbshipit-source-id: e42b8a0d018b37fb558abd53d765fbdd676c51a2 --- packages/react-native/scripts/react-native-xcode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/scripts/react-native-xcode.sh b/packages/react-native/scripts/react-native-xcode.sh index fabf14fef34..3e1742cd8d1 100755 --- a/packages/react-native/scripts/react-native-xcode.sh +++ b/packages/react-native/scripts/react-native-xcode.sh @@ -127,7 +127,7 @@ fi PACKAGER_SOURCEMAP_FILE= if [[ $EMIT_SOURCEMAP == true ]]; then if [[ $USE_HERMES != false ]]; then - PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename $SOURCEMAP_FILE)" + PACKAGER_SOURCEMAP_FILE="$CONFIGURATION_BUILD_DIR/$(basename "$SOURCEMAP_FILE")" else PACKAGER_SOURCEMAP_FILE="$SOURCEMAP_FILE" fi