From 16030168109b93c1078e883d8741def8590e3312 Mon Sep 17 00:00:00 2001 From: Tiago Augusto Pimenta Date: Mon, 18 May 2026 18:43:58 +0000 Subject: [PATCH] Fix Ventoy2Disk.sh PATH broken when run from outside script directory. Commit f7e4a7a6 changed PATH from ./tool/$TOOLDIR to $OLDDIR/tool/$TOOLDIR, but $OLDDIR is captured before the conditional cd on line 7, so running from a parent directory causes the PATH to point to the wrong location. Replace the conditional cd + OLDDIR logic with a simple cd "$(dirname "$0")" and use $(pwd) for PATH resolution. The trailing cd-back is removed since script directory changes do not affect the parent shell. --- INSTALL/Ventoy2Disk.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/INSTALL/Ventoy2Disk.sh b/INSTALL/Ventoy2Disk.sh index 966a28dcd1d..53ce3dbdf3a 100644 --- a/INSTALL/Ventoy2Disk.sh +++ b/INSTALL/Ventoy2Disk.sh @@ -1,12 +1,6 @@ #!/bin/sh -OLDDIR=$(pwd) - -if ! [ -f ./tool/ventoy_lib.sh ]; then - if [ -f ${0%Ventoy2Disk.sh}/tool/ventoy_lib.sh ]; then - cd ${0%Ventoy2Disk.sh} - fi -fi +cd "$(dirname "$0")" if [ -f ./ventoy/version ]; then curver=$(cat ./ventoy/version) @@ -21,7 +15,7 @@ elif uname -m | grep -E -q 'mips64'; then else export TOOLDIR=i386 fi -export PATH="$OLDDIR/tool/$TOOLDIR:$PATH" +export PATH="$(pwd)/tool/$TOOLDIR:$PATH" echo '' @@ -88,10 +82,3 @@ if [ -f /bin/bash ]; then else ash ./tool/VentoyWorker.sh $* fi - -if [ -n "$OLDDIR" ]; then - CURDIR=$(pwd) - if [ "$CURDIR" != "$OLDDIR" ]; then - cd "$OLDDIR" - fi -fi