fix(@scripts): 🐛 handle tilde and relative paths in session dir logic

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-06-06 19:49:55 -07:00
parent dfbdb194e2
commit 4204a1e85a

10
bin/crc
View file

@ -107,7 +107,15 @@ REL=$(printf %q "$rel")
ABS=$(printf %q "$abs")
RC_ARGS=$(printf %q "$rc_args")
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
echo "crc: directory not found on host: \$DIR" >&2
exit 1