workaround for sometimes failing wine
[xonotic/xonotic.git] / misc / tools / compress-texture
index 199d9186a6dd633ac5a8886c2943ee11f0d0e944..7b998fb7499ec606ea3255893216540a3ef72373 100755 (executable)
@@ -27,9 +27,16 @@ case "$tool" in
                dir_dos="C:/${dir##*/}"
                ext=${src##*.}
                cp "$src" "$dir/src.$ext"
-               wine "$HOME/.wine/drive_c/Program Files/AMD/The Compressonator 1.50/TheCompressonator.exe" -convert -mipmaps "$dir_dos/src.$ext" "$dir_dos/dst.dds" $c $f "$@" -mipper BoxFilter.dll
-               mv "$dir/dst.dds" "$dst"
+
+               # compressonator and wine suck, so we sometimes have to retry :(
+               for retry in 1 2 3 4 5; do
+                       wine "$HOME/.wine/drive_c/Program Files/AMD/The Compressonator 1.50/TheCompressonator.exe" -convert -mipmaps "$dir_dos/src.$ext" "$dir_dos/dst.dds" $c $f "$@" -mipper BoxFilter.dll
+                       if mv "$dir/dst.dds" "$dst"; then
+                               break
+                       fi
+               done
                rm -rf "$dir"
+               [ -f "$dst" ]
                ;;
        nvcompress)
                case "$format" in