Skip to content

Commit

Permalink
misc: don't initialize the Wine prefix before every single verb
Browse files Browse the repository at this point in the history
This reduces the run time of `winetricks allfonts` on Wine 9.22 on my
Intel i7-1360P laptop from 5 minutes 19 seconds to 3 minutes 34 seconds,
a 33% decrease.
  • Loading branch information
alexhenrie committed Jan 7, 2025
1 parent b7cf27d commit 21f2f73
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/winetricks
Original file line number Diff line number Diff line change
Expand Up @@ -4361,11 +4361,17 @@ winetricks_set_wineprefix()
# Note: these are arch independent, but are needed by some arch dependent variables
# Defining here to avoid having two arch checks:
if ! test "$1"; then
WINEPREFIX="${WINETRICKS_ORIGINAL_WINEPREFIX}"
NEW_WINEPREFIX="${WINETRICKS_ORIGINAL_WINEPREFIX}"
else
WINEPREFIX="${W_PREFIXES_ROOT}/$1"
NEW_WINEPREFIX="${W_PREFIXES_ROOT}/$1"
fi

if test "${WINEPREFIX}" = "${NEW_WINEPREFIX}"; then
# A previous verb already set the prefix
return
fi

WINEPREFIX="${NEW_WINEPREFIX}"
export WINEPREFIX
w_try_mkdir "$(dirname "${WINEPREFIX}")"

Expand Down

0 comments on commit 21f2f73

Please sign in to comment.