From 0c05347c30289b13d7ebe83ac859898940566641 Mon Sep 17 00:00:00 2001 From: Eggie Date: Sat, 14 Mar 2026 18:15:07 +0800 Subject: [PATCH] fix: add app-root symlink for packaged SwiftPM resource bundle --- scripts/create-dmg.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/create-dmg.sh b/scripts/create-dmg.sh index 9c287a4..862b0e4 100755 --- a/scripts/create-dmg.sh +++ b/scripts/create-dmg.sh @@ -84,7 +84,13 @@ cp "$DYLIB" "$APP_DIR/Contents/Frameworks/libphemy_core.dylib" RESOURCE_BUNDLE="$PROJECT_DIR/.build/arm64-apple-macosx/release/PhemyNative_PhemyNative.bundle" if [ -d "$RESOURCE_BUNDLE" ]; then cp -R "$RESOURCE_BUNDLE" "$APP_DIR/Contents/Resources/PhemyNative_PhemyNative.bundle" - echo " Copied SPM resource bundle" + # SwiftPM's generated resource_bundle_accessor may incorrectly probe the app root + # before falling back to the build directory. Add a compatibility symlink at the + # app bundle root so release builds can still resolve Bundle.module after packaging. + if [ ! -e "$APP_DIR/PhemyNative_PhemyNative.bundle" ]; then + ln -s "Contents/Resources/PhemyNative_PhemyNative.bundle" "$APP_DIR/PhemyNative_PhemyNative.bundle" + fi + echo " Copied SPM resource bundle and ensured app-root compatibility symlink" else echo "WARNING: SPM resource bundle not found at $RESOURCE_BUNDLE" fi