diff --git a/home/stormux/.local/.functions/game_install_functions.sh b/home/stormux/.local/.functions/game_install_functions.sh index 5361110..4114e69 100755 --- a/home/stormux/.local/.functions/game_install_functions.sh +++ b/home/stormux/.local/.functions/game_install_functions.sh @@ -147,6 +147,41 @@ install_with_progress() { esac } +prepare_wine_game_dirs() { + local driveC="${WINEPREFIX}/drive_c" + local gamesWineRoot="${HOME}/.local/games/Wine" + local programName + local sourceDir + local targetDir + local item + + [[ -d "$driveC" ]] || return 0 + + for programName in "Program Files" "Program Files (x86)"; do + sourceDir="${driveC}/${programName}" + targetDir="${gamesWineRoot}/${programName}" + + mkdir -p "$targetDir" + + if [[ -L "$sourceDir" ]]; then + continue + fi + + if [[ -d "$sourceDir" ]]; then + shopt -s dotglob nullglob + for item in "$sourceDir"/*; do + mv -n "$item" "$targetDir/" + done + shopt -u dotglob nullglob + rmdir "$sourceDir" 2> /dev/null || true + fi + + if [[ ! -e "$sourceDir" ]]; then + ln -s "$targetDir" "$sourceDir" + fi + done +} + install_wine_bottle() { local dep local depsToInstall=() @@ -170,6 +205,7 @@ install_wine_bottle() { ui_progressbox "Wine Setup" "Initializing Wine bottle" < /dev/null DISPLAY="${DISPLAY:-}" wine wineboot -u fi + prepare_wine_game_dirs for dep in "$@"; do case "$dep" in