From 68e1eb53827acb4a29d244a30345449294e032c7 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Wed, 15 Oct 2025 19:43:57 -0400 Subject: [PATCH] fix: don't crash if public dir does not exist On my machine, I do not have a `~/Public` directory, which causes quickqemu to spit out a warning and then crash: ```console $ quickemu --vm vm.conf - WARNING! Public directory: '/home/jeremy/Public' doesn't exist! Quickemu 4.9.7 using /nix/store/nk59c14nwf79bafmrsnnhndmpnrlplrv-qemu-10.1.0/bin/qemu-system-x86_64 v10.1.0 ... - 9P: On guest: sudo mount -t 9p -o trans=virtio,version=9p2000.L,msize=104857600 ~/Public ... - Process: ERROR! Failed to start /nix/store/va3md6gv82fqf7pxbfxd0cd5gfnmnz9f-vm.conf as va3md6gv82fqf7pxbfxd0cd5gfnmnz9f-vm qemu-system-x86_64: -netdev user,hostname=va3md6gv82fqf7pxbfxd0cd5gfnmnz9f-vm,hostfwd=tcp::22220-:22,smb=/home/jeremy/Public,id=nic: Error accessing shared directory '/home/jeremy/Public': No such file or directory ``` Here's my `vm.conf`. Note how I'm not asking for a public dir: ``` iso="/nix/store/q3j8357dz3kmyjv84wfj4pyn20b65h9l-nixos-minimal-25.11pre-git-x86_64-linux.iso/iso/nixos-minimal-25.11pre-git-x86_64-linux.iso" ``` --- quickemu | 1 + 1 file changed, 1 insertion(+) diff --git a/quickemu b/quickemu index caa8454..09581fa 100755 --- a/quickemu +++ b/quickemu @@ -1823,6 +1823,7 @@ function fileshare_param_check() { if [ ! -d "${PUBLIC}" ]; then echo " - WARNING! Public directory: '${PUBLIC}' doesn't exist!" + PUBLIC="" else PUBLIC_TAG="Public-${USER,,}" PUBLIC_PERMS=$(${STAT} -c "%A" "${PUBLIC}")