diff --git a/README.md b/README.md index 35f4e84..4b351f4 100644 --- a/README.md +++ b/README.md @@ -40,5 +40,4 @@ A feature-barren DOS clone of `ls` that hides Windows hidden files. Relies on - `explorer.sh`: Launch explorer from WSL. - `pwsh.sh`: Launch PowerShell Core. - `terminal.sh`: Launch Windows Terminal. -- `userprofile.sh`: Get the Windows user profile directory (`%USERPROFILE%`). diff --git a/dos-var/justfile b/dos-var/justfile new file mode 100644 index 0000000..fadd97b --- /dev/null +++ b/dos-var/justfile @@ -0,0 +1,10 @@ + +alias b := build +alias i := install + +build: + cargo build --release + +install DIR: build + cp ./target/release/dos-var "{{DIR}}/dos-var" + diff --git a/scripts/pwsh.sh b/scripts/pwsh.sh index 6691297..2f987c1 100755 --- a/scripts/pwsh.sh +++ b/scripts/pwsh.sh @@ -13,7 +13,7 @@ fi # fall back to user installation if [ -z ${PWSH+x} ]; then - PWSH="`userprofile`/AppData/Local/Microsoft/WindowsApps/pwsh.exe" + PWSH="`dos-var -p USERPROFILE`/AppData/Local/Microsoft/WindowsApps/pwsh.exe" fi # run target diff --git a/scripts/userprofile.sh b/scripts/userprofile.sh deleted file mode 100755 index ba8902c..0000000 --- a/scripts/userprofile.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash - -# absolutely monstrous string hackery -# get %USERPROFILE% using cmd and convert that path -USERPROFILE=`/mnt/c/Windows/System32/cmd.exe '/C' 'echo %USERPROFILE%' 2> /dev/null` -USERPROFILE=${USERPROFILE//\\//} # replace '\' separators with '/' -USERPROFILE=/mnt/c/${USERPROFILE#C:/} # replace 'C:/' with '/mnt/c/' -USERPROFILE=${USERPROFILE%$'\r'} # strip carriage return -echo $USERPROFILE -