Compare commits
2 commits
2798682a1d
...
190f17f7e2
Author | SHA1 | Date | |
---|---|---|---|
190f17f7e2 | |||
18389ca9b8 |
5 changed files with 24 additions and 7 deletions
|
@ -36,4 +36,5 @@ 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%`).
|
||||||
|
|
||||||
|
|
11
env-share/justfile
Normal file
11
env-share/justfile
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
alias b := build
|
||||||
|
alias i := install
|
||||||
|
|
||||||
|
build:
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
install DIR: build
|
||||||
|
cp ./target/release/env-share "{{DIR}}/env-share"
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,5 @@ install DIR="~/.bin":
|
||||||
cp explorer.sh {{DIR}}/explorer
|
cp explorer.sh {{DIR}}/explorer
|
||||||
cp pwsh.sh {{DIR}}/pwsh
|
cp pwsh.sh {{DIR}}/pwsh
|
||||||
cp terminal.sh {{DIR}}/terminal
|
cp terminal.sh {{DIR}}/terminal
|
||||||
|
cp userprofile.sh {{DIR}}/userprofile
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,7 @@ fi
|
||||||
|
|
||||||
# fall back to user installation
|
# fall back to user installation
|
||||||
if [ -z ${PWSH+x} ]; then
|
if [ -z ${PWSH+x} ]; then
|
||||||
# absolutely monstrous string hackery
|
PWSH="`userprofile`/AppData/Local/Microsoft/WindowsApps/pwsh.exe"
|
||||||
# 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
|
|
||||||
PWSH="$USERPROFILE/AppData/Local/Microsoft/WindowsApps/pwsh.exe"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run target
|
# run target
|
||||||
|
|
10
scripts/userprofile.sh
Executable file
10
scripts/userprofile.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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