From b77090fd4492dd631fbd1507f5e1beae90f4a053 Mon Sep 17 00:00:00 2001 From: murkl Date: Sun, 7 Apr 2024 16:44:41 +0200 Subject: [PATCH] exclude files --- d2launcher | 19 ++++++++++++++----- docs/README.md | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/d2launcher b/d2launcher index 9293b97..0b7e7d8 100755 --- a/d2launcher +++ b/d2launcher @@ -95,6 +95,9 @@ mxl_update_check="true" mxl_update_channel="public" # or beta d2_stats_tray="true" +# Patch +mxl_update_exclude=() + # Gui gui_width="450" gui_height="380" @@ -513,16 +516,22 @@ show_gui_mxl_patches() { return 1 fi - # Remove patched files from d2 dir - mapfile -t patched_files < <(zipinfo -1 "${MXL_PATCHES_DIR}/$(<"$d2_dir/$MXL_PATCH_VERSION").zip") - for item in "${patched_files[@]}"; do rm -f "${d2_dir}/${item}"; done - ( + # Remove patched files from d2 dir + if [ -f "${MXL_PATCHES_DIR}/$(<"${d2_dir}/${MXL_PATCH_VERSION}").zip" ]; then + mapfile -t patched_files < <(zipinfo -1 "${MXL_PATCHES_DIR}/$(<"${d2_dir}/${MXL_PATCH_VERSION}").zip") + for item in "${patched_files[@]}"; do rm -f "${d2_dir}/${item}"; done + fi + # Patching Diablo II core data unzip -o "$D2_CORE_PATCH_FILE" -d "$d2_dir" # Patching content of patch file to Diablo II dir - unzip -o "$MXL_PATCHES_DIR/$patch_filename.zip" -d "$d2_dir" + if [ -z "${mxl_update_exclude[*]}" ]; then + unzip -o "$MXL_PATCHES_DIR/$patch_filename.zip" -d "$d2_dir" + else + unzip -o "$MXL_PATCHES_DIR/$patch_filename.zip" -d "$d2_dir" -x "${mxl_update_exclude[@]}" + fi echo "$patch_filename" >"$d2_dir/$MXL_PATCH_VERSION" ) & diff --git a/docs/README.md b/docs/README.md index 7aac2f0..6897ad8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -62,6 +62,11 @@ All files are located here: `~/.d2launcher`. Simply copy & paste to another syst The logging file is `~/.d2launcher/d2launcher.log` and is **not** rotated. This contains only logs from execution of Diablo II. +## Exclude files from update patch + +Add this array property to exclude files from update +`mxl_update_exclude=("file1" "file2")` + ## Example `d2launcher.conf` ``` @@ -75,6 +80,7 @@ mxl_update_check="true" mxl_update_channel="public" gui_width="420" gui_height="320" +mxl_update_exclude=("cnc-ddraw config.exe" "ddraw.dll") ``` ## Median XL Beta