Skip to content

Commit 3b88591

Browse files
r6915eeNexIsDumb
andauthored
Use sh alternatives and fix change directory in building shell scripts (#769)
* Use sh alternatives and fix change directory in building shell scripts The usage of the cd command in the shell scripts under building/ can conflict at some point during the procedure. As far as I'm aware, it's supposed to cd to the parent directory, but it does so strangely. On some occasions, this may cause the directory to switch to /tmp on Linux instead. This commit resolves that by instead using the typical .. syntax, which is a shorthand for the parent directory of the process. Additionally, proper shebangs have been added that instead use "/usr/bin/env sh", which returns the path to a suitable sh alternative: that is, the closest program that can be found using 'sh' in the name. This is one of the most recommended shebangs for a shell script, due to 'env' typically being in the exact same position. * Update cd in building shell scripts to use script relative path properly The two prior versions would use the working directory's own parent directory, not the script's. This commit simply makes it so that changing the directory in the script uses its directory's parent instead. * dont mind me --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
1 parent bacd218 commit 3b88591

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

building/cne-unix.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
cd "$(dirname "$(cd "$(dirname "$0")" && pwd)")"
1+
#!/usr/bin/env sh
2+
cd "$(dirname "$0")/.."
23
haxe -cp commandline -D analyzer-optimize --run Main $@

building/setup-unix.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
cd "$(dirname "$(cd "$(dirname "$0")" && pwd)")"
1+
#!/usr/bin/env sh
2+
cd "$(dirname "$0")/.."
23
haxe -cp commandline -D analyzer-optimize --run Main setup

0 commit comments

Comments
 (0)