From bb8ddd6c1247fde230a60c662a318422df52516e Mon Sep 17 00:00:00 2001 From: Ian Childs Date: Tue, 22 Feb 2022 02:17:47 -0800 Subject: [PATCH] Use realpath instead of readlink Summary: Changelog: [Internal] Generated with: ``` python3 codemod.py -d xplat/js --extensions=sh 'THIS_DIR=\$\(cd -P "\$\(dirname "\$\(readlink "\${BASH_SOURCE\[0\]}"' 'THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}"'``` Reviewed By: motiz88 Differential Revision: D34379955 fbshipit-source-id: c60521cd6508b203f48ca8c890c450319991c2d4 --- packages/react-native-codegen/scripts/oss/build.sh | 2 +- .../src/cli/combine/combine_js_to_schema.sh | 2 +- .../react-native-codegen/src/cli/generators/generate-all.sh | 2 +- packages/react-native-codegen/src/cli/parser/parser.sh | 2 +- runXcodeTests.sh | 2 +- scripts/objc-test.sh | 2 +- scripts/packager.sh | 2 +- scripts/run-android-emulator.sh | 2 +- scripts/update_podfile_lock.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native-codegen/scripts/oss/build.sh b/packages/react-native-codegen/scripts/oss/build.sh index fc9895851f44a8..5822ffb7cf3b06 100755 --- a/packages/react-native-codegen/scripts/oss/build.sh +++ b/packages/react-native-codegen/scripts/oss/build.sh @@ -6,7 +6,7 @@ # This script assumes yarn is already installed. -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) set -e set -u diff --git a/packages/react-native-codegen/src/cli/combine/combine_js_to_schema.sh b/packages/react-native-codegen/src/cli/combine/combine_js_to_schema.sh index ed6931a38cff12..3d4718d538820e 100755 --- a/packages/react-native-codegen/src/cli/combine/combine_js_to_schema.sh +++ b/packages/react-native-codegen/src/cli/combine/combine_js_to_schema.sh @@ -7,7 +7,7 @@ set -e set -u -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) # shellcheck source=xplat/js/env-utils/setup_env_vars.sh source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh" diff --git a/packages/react-native-codegen/src/cli/generators/generate-all.sh b/packages/react-native-codegen/src/cli/generators/generate-all.sh index 45c7db81dcaa64..cf5e3f9276f044 100755 --- a/packages/react-native-codegen/src/cli/generators/generate-all.sh +++ b/packages/react-native-codegen/src/cli/generators/generate-all.sh @@ -7,7 +7,7 @@ set -e set -u -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) # shellcheck source=xplat/js/env-utils/setup_env_vars.sh source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh" diff --git a/packages/react-native-codegen/src/cli/parser/parser.sh b/packages/react-native-codegen/src/cli/parser/parser.sh index 56b708fe89ea49..8d130f250017be 100755 --- a/packages/react-native-codegen/src/cli/parser/parser.sh +++ b/packages/react-native-codegen/src/cli/parser/parser.sh @@ -7,7 +7,7 @@ set -e set -u -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) # shellcheck source=xplat/js/env-utils/setup_env_vars.sh source "$THIS_DIR/../../../../../../env-utils/setup_env_vars.sh" diff --git a/runXcodeTests.sh b/runXcodeTests.sh index c071a4c0548c76..17f82932ef0582 100755 --- a/runXcodeTests.sh +++ b/runXcodeTests.sh @@ -6,7 +6,7 @@ # This script should be run from the react-native root -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) source "scripts/.tests.env" if [ -n "$1" ] diff --git a/scripts/objc-test.sh b/scripts/objc-test.sh index b5ace1afa869ef..d2d6ecaa0075cc 100755 --- a/scripts/objc-test.sh +++ b/scripts/objc-test.sh @@ -78,7 +78,7 @@ xcprettyFormat() { # Circle CI expects JUnit reports to be available here REPORTS_DIR="$HOME/react-native/reports/junit" else - THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) + THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) # Write reports to the react-native root dir REPORTS_DIR="$THIS_DIR/../build/reports" diff --git a/scripts/packager.sh b/scripts/packager.sh index acb1581257863f..b9f90160f1aec8 100755 --- a/scripts/packager.sh +++ b/scripts/packager.sh @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. # scripts directory -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${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/../../.." diff --git a/scripts/run-android-emulator.sh b/scripts/run-android-emulator.sh index 99c5b6444923a1..2f246b4af5a8d3 100755 --- a/scripts/run-android-emulator.sh +++ b/scripts/run-android-emulator.sh @@ -10,7 +10,7 @@ # virtual device configuration. # This is useful for running integration tests on a local machine. -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) STATE=`adb get-state` diff --git a/scripts/update_podfile_lock.sh b/scripts/update_podfile_lock.sh index 87b559264b1be1..fa6db464666ebb 100755 --- a/scripts/update_podfile_lock.sh +++ b/scripts/update_podfile_lock.sh @@ -8,7 +8,7 @@ # Usage: # source scripts/update_podfile_lock && update_pods -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) +THIS_DIR=$(cd -P "$(dirname "$(realpath "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) RNTESTER_DIR="$THIS_DIR/../packages/rn-tester" # Keep this separate for FB internal access.