Skip to content

Commit 48a35df

Browse files
author
Test
committed
Add platform detection logic to giv.sh for improved compatibility
1 parent 56f5bc8 commit 48a35df

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/giv.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ get_script_dir() {
2525
cd "$(dirname "${target}")" 2>/dev/null && pwd
2626
fi
2727
}
28-
# --- 5. Compute APP_DIR ---
28+
29+
detect_platform() {
30+
OS="$(uname -s)"
31+
case "$OS" in
32+
Linux*)
33+
if [ -f /etc/wsl.conf ] || grep -qi microsoft /proc/version 2>/dev/null; then
34+
printf 'windows'
35+
else
36+
printf 'linux'
37+
fi;;
38+
Darwin*) printf 'macos';;
39+
CYGWIN*|MINGW*|MSYS*) printf 'windows';;
40+
*) printf 'unsupported';;
41+
esac
42+
}
43+
2944
compute_app_dir() {
3045
case "$PLATFORM" in
3146
linux)
@@ -69,6 +84,8 @@ fi
6984
SCRIPT_DIR="$(get_script_dir "${SCRIPT_PATH}")"
7085

7186
# Allow overrides for advanced/testing/dev
87+
88+
PLATFORM="$(detect_platform)"
7289
APP_DIR="$(compute_app_dir)"
7390
printf 'Using giv app directory: %s\n' "${APP_DIR}"
7491
LIB_DIR=""

0 commit comments

Comments
 (0)