scripts: removed 'userprofile' script in favor of 'dos-var'
This commit is contained in:
parent
3fd510a45c
commit
32731b72b1
4 changed files with 11 additions and 12 deletions
|
@ -40,5 +40,4 @@ A feature-barren DOS clone of `ls` that hides Windows hidden files. Relies on
|
||||||
- `explorer.sh`: Launch explorer from WSL.
|
- `explorer.sh`: Launch explorer from WSL.
|
||||||
- `pwsh.sh`: Launch PowerShell Core.
|
- `pwsh.sh`: Launch PowerShell Core.
|
||||||
- `terminal.sh`: Launch Windows Terminal.
|
- `terminal.sh`: Launch Windows Terminal.
|
||||||
- `userprofile.sh`: Get the Windows user profile directory (`%USERPROFILE%`).
|
|
||||||
|
|
||||||
|
|
10
dos-var/justfile
Normal file
10
dos-var/justfile
Normal file
|
@ -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"
|
||||||
|
|
|
@ -13,7 +13,7 @@ fi
|
||||||
|
|
||||||
# fall back to user installation
|
# fall back to user installation
|
||||||
if [ -z ${PWSH+x} ]; then
|
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
|
fi
|
||||||
|
|
||||||
# run target
|
# run target
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
Loading…
Reference in a new issue