Skip to content

Commit

Permalink
Use DOS path instead UNIX when minimizin
Browse files Browse the repository at this point in the history
When using "wine_nt_to_unix_file_name" to search for files accessed by the Wine application, some files are summarily ignored.

Although in most cases these files are irrelevant, in some cases important files like "comdlg32.dll" are also excluded
  • Loading branch information
sudo-give-me-coffee committed Aug 22, 2020
1 parent e2d5e2a commit 82fee58
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions data/AppDirTool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,28 @@ function appdir.minimize(){
REFERENCE_FILE=$(mktemp)

echo "[ 2/5 ] Initializing test..."
used_files_symlink=($(${BOTTLE_NAME}.AppDir/AppRun | grep -i "c:/windows" \
| grep "wine_nt_to_unix_file_name" \
| cut -d\" -f4 | sort | uniq))
used_files_symlink=($(${BOTTLE_NAME}.AppDir/AppRun | grep "c:/windows" \
| cut -d\" -f2 \
| sed 's|^\\\\??\\\\C:||g;/windows\/Fonts/d;s|\\\\|/|g' \
| sort | uniq ))

echo "[ 3/5 ] Fetching bottle unused files..."
for file in "${used_files_symlink[@]}"; do
real_file=$(readlink -f "${file}")
real_file=$(readlink -f "${BOTTLE_NAME}.AppDir/prefix/drive_c${file,,}")
[ -f "${real_file}" ] && {
touch "${real_file}"
}
done

echo "[ 4/5 ] Removing unused files..."

cd "${BOTTLE_NAME}.AppDir"

# Ensures sure that some files are kept
touch "prefix/drive_c/windows/system32/ntdll.dll"
touch "prefix/drive_c/windows/explorer.exe"
touch "prefix/drive_c/windows/notepad.exe"

# Remove unneeded Wine DLLs
[ "${1}" = "--append-to-script" ] && {
delete_list_dlls=$(find ./"prefix/drive_c/windows" -type f -not -anewer ${REFERENCE_FILE} -print)
Expand Down Expand Up @@ -198,8 +204,13 @@ function appdir.minimize(){
find . -type l ! -exec test -e {} \; -delete

# Remove old installers and temporary files
find ./"prefix/drive_c/windows/Installer" -type f -delete
find ./"prefix/drive_c/windows/temp" -type f -delete
[ -f ./"prefix/drive_c/windows/Installer" ] && {
rm ./"prefix/drive_c/windows/Installer"
}

[ -f ./"prefix/drive_c/windows/temp" ] && {
rm ./"prefix/drive_c/windows/Installer"
}

echo "[ 5/5 ] Ending test..."
rm -rf ${HOME}
Expand Down

0 comments on commit 82fee58

Please sign in to comment.