fix(@scripts): 🐛 handle tilde and relative paths in session dir logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
dfbdb194e2
commit
4204a1e85a
1 changed files with 9 additions and 1 deletions
10
bin/crc
10
bin/crc
|
|
@ -107,7 +107,15 @@ REL=$(printf %q "$rel")
|
||||||
ABS=$(printf %q "$abs")
|
ABS=$(printf %q "$abs")
|
||||||
RC_ARGS=$(printf %q "$rc_args")
|
RC_ARGS=$(printf %q "$rc_args")
|
||||||
SESS=$(printf %q "$session")
|
SESS=$(printf %q "$session")
|
||||||
if [ -n "\$ABS" ]; then DIR=\$ABS; else DIR="\$HOME\${REL:+/\$REL}"; fi
|
if [ -n "\$ABS" ]; then
|
||||||
|
case "\$ABS" in
|
||||||
|
"~") DIR=\$HOME ;;
|
||||||
|
"~/"*) DIR="\$HOME/\${ABS#~/}" ;;
|
||||||
|
*) DIR=\$ABS ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
DIR="\$HOME\${REL:+/\$REL}"
|
||||||
|
fi
|
||||||
if ! cd "\$DIR" 2>/dev/null; then
|
if ! cd "\$DIR" 2>/dev/null; then
|
||||||
echo "crc: directory not found on host: \$DIR" >&2
|
echo "crc: directory not found on host: \$DIR" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue