Use QVM_BIN_DIR fallback for script paths and set in flake

This commit is contained in:
Joshua Bell 2026-01-26 10:27:57 -06:00
parent 8d68e1daf9
commit 7864673dcb
6 changed files with 13 additions and 14 deletions

View file

@ -159,6 +159,9 @@ main() {
exit 0
fi
# Ensure directories exist before accessing workspaces.json
ensure_dirs
# If no command given, default to interactive zsh shell
local run_shell=false
if [[ $# -eq 0 ]]; then
@ -188,10 +191,8 @@ main() {
if [[ "$newly_added" -eq 1 ]] && is_vm_running; then
log_info "New workspace registered. Restarting VM to mount it..."
# Path to qvm-stop and qvm-start scripts
local script_dir="${QVM_LIB_DIR}/../bin"
local qvm_stop="$script_dir/qvm-stop"
local qvm_start="$script_dir/qvm-start"
local qvm_stop="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-stop"
local qvm_start="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-start"
# Stop the VM
if ! "$qvm_stop"; then
@ -210,8 +211,7 @@ main() {
if ! is_vm_running; then
log_info "VM not running, starting..."
# Path to qvm-start script
local qvm_start="${QVM_LIB_DIR}/../bin/qvm-start"
local qvm_start="${QVM_BIN_DIR:-$(dirname "$0")}/qvm-start"
if ! "$qvm_start"; then
die "Failed to start VM"