Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Use etag to avoid downloading everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
js6pak authored Jul 15, 2022
1 parent 2b8b9ed commit 80c75da
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ApexCacheLauncher
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ else

if [[ "$CACHE_DIR" = */DXVK_state_cache ]]; then

wget https://github.com/bcook254/apex-legends-cache/raw/main/r5apex.dxvk-cache -O "$CACHE_DIR"/r5apex.new.dxvk-cache ## Download new cache file
NEW_CACHE="$CACHE_DIR"/r5apex.new.dxvk-cache

## Download new cache file but only if it was updated
curl -L https://github.com/bcook254/apex-legends-cache/raw/main/r5apex.dxvk-cache -o $NEW_CACHE --etag-save $NEW_CACHE.etag --etag-compare $NEW_CACHE.etag

if [ ! -f $NEW_CACHE ] && [ -f $NEW_CACHE.etag ]; then
echo "No new state cache changes found"
exit
fi

if [ ! -f "$CACHE_DIR"/dxvk-cache-tool ]; then ## Check if the cache tool is installed

Expand All @@ -55,13 +63,13 @@ else

if [ ! -f "$CACHE_DIR"/r5apex.dxvk-cache ]; then ## Check if a cache exists
echo "Cache file does not exist. Adding..."
mv "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.dxvk-cache ## Rename "Add" cache file.
mv $NEW_CACHE "$CACHE_DIR"/r5apex.dxvk-cache ## Rename "Add" cache file.
notify-send "Installed Apex Legends DXVK State Cache" "DXVK Cache was not found, installed from GitHub."
else
echo "Cache file found. Merging..."
mv "$CACHE_DIR"/r5apex.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache ## Rename Old Cache File
"$CACHE_DIR"/dxvk-cache-tool "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache -o "$CACHE_DIR"/r5apex.dxvk-cache ## Merge cache files
rm "$CACHE_DIR"/r5apex.new.dxvk-cache "$CACHE_DIR"/r5apex.old.dxvk-cache ## Remove old cache files
"$CACHE_DIR"/dxvk-cache-tool $NEW_CACHE "$CACHE_DIR"/r5apex.old.dxvk-cache -o "$CACHE_DIR"/r5apex.dxvk-cache ## Merge cache files
rm $NEW_CACHE "$CACHE_DIR"/r5apex.old.dxvk-cache ## Remove old cache files
notify-send "Merged Apex Legends DXVK State Cache" "Downloaded and Merged DXVK Cache."
fi

Expand Down

0 comments on commit 80c75da

Please sign in to comment.