From 459c17690573de36d21c502df03d3f15801d2f7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?=
 <31292499+krystofwoldrich@users.noreply.github.com>
Date: Tue, 5 Dec 2023 11:02:19 +0100
Subject: [PATCH] fix(xcode): Collect modules path from shell (#3451)

---
 CHANGELOG.md               | 1 +
 scripts/collect-modules.sh | 2 +-
 scripts/sentry-xcode.sh    | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0de14c30c7..a6d549a5b5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
   - This fix requires a rebuild of the native app
 - Symbolicate message and non-Error stacktraces locally in debug mode ([#3420](https://github.com/getsentry/sentry-react-native/pull/3420))
 - Remove Sentry SDK frames from rejected promise SyntheticError stack ([#3423](https://github.com/getsentry/sentry-react-native/pull/3423))
+- Fix path from Xcode scripts to Collect Modules ([#3451](https://github.com/getsentry/sentry-react-native/pull/3451))
 
 ### Dependencies
 
diff --git a/scripts/collect-modules.sh b/scripts/collect-modules.sh
index 091ae13af9..419d2e4ac2 100755
--- a/scripts/collect-modules.sh
+++ b/scripts/collect-modules.sh
@@ -29,7 +29,7 @@ if [[ -n "$NODE_BINARY" ]]; then
 fi
 
 thisFilePath=$(dirname $0)
-collectModulesScript="$thisFilePath/../../dist/js/tools/collectModules.js"
+collectModulesScript="$thisFilePath/../dist/js/tools/collectModules.js"
 
 destination="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
 modulesOutput="$destination/modules.json"
diff --git a/scripts/sentry-xcode.sh b/scripts/sentry-xcode.sh
index 3fb0e68a6c..bf024ea6b5 100755
--- a/scripts/sentry-xcode.sh
+++ b/scripts/sentry-xcode.sh
@@ -25,7 +25,7 @@ else
   /bin/sh -c "$REACT_NATIVE_XCODE"
 fi
 
-[ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../../scripts/collect-modules.sh"
+[ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_COLLECT_MODULES="../node_modules/@sentry/react-native/scripts/collect-modules.sh"
 
 if [ -f "$SENTRY_COLLECT_MODULES" ]; then
   /bin/sh "$SENTRY_COLLECT_MODULES"