Skip to content

Commit

Permalink
Use readlink instead of realpath in packager.sh (#34145)
Browse files Browse the repository at this point in the history
Summary:
`realpath` is not available on macOS 12.2 and 12.4. Because of this, the following error is shown when launching an RN app with XCode (which calls `packager.sh` via `launchPackage.command`):

<img width="1123" alt="Screen Shot 2022-07-06 at 1 26 08 PM" src="https://user-images.githubusercontent.com/218725/177608681-0cf4dc5a-b71c-4ddc-8fbe-4d37b2d3e2cb.png">

I am running Bash 5 but realpath is also not available with zsh.

This issue was introduced in bb8ddd6#diff-6ca7c99209bdf630550bb9e2946ce8611948c5a23b32ffb25028792ef5d48b8d, which interestingly did not change `launchPackage.command`. There's a recent comment on that commit that confirms this issue:

bb8ddd6#commitcomment-77818917

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Use readlink instead of realpath in packager.sh

Pull Request resolved: #34145

Reviewed By: cipolleschi

Differential Revision: D37669417

Pulled By: cortinico

fbshipit-source-id: bcc4cb6e886df059e6598ee811226e3cd1a6ae14
  • Loading branch information
dminkovsky authored and facebook-github-bot committed Jul 20, 2022
1 parent e1d17c8 commit 698b147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/packager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# LICENSE file in the root directory of this source tree.

# scripts directory
THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
REACT_NATIVE_ROOT="$THIS_DIR/.."
# Application root directory - General use case: react-native is a dependency
PROJECT_ROOT="$THIS_DIR/../../.."
Expand Down

0 comments on commit 698b147

Please sign in to comment.