modified save folder name to match convention.
[feisty_meow.git] / customizing / fred / scripts / gamesaver.sh
index def0d89ac07b44b8bc1f96bc426b2540523fb033..f86f305b74ea7f544bbb72dbe49cb277a602f808 100644 (file)
@@ -1,20 +1,57 @@
+#!/bin/bash
 
-# hmmm: some better work could be done to have both names (wineprefix and storage dir) be iterable.
-for i in oblivion fallout_new_vegas fallout_3 skyrim ; do
-  if [ ! -d $HOME/spooling_saves/$i ]; then
-    mkdir -p $HOME/spooling_saves/$i 
+# a helpful script that scrapes any active game saves from wine's storage
+# area into a spooling saves folder for archiving.
+
+source $FEISTY_MEOW_SCRIPTS/core/functions.sh
+
+WINE_SOURCE_DIR="$HOME/wine_goods/My Games"
+SPOOLING_OUTPUT_DIR="$HOME/spooling_saves"
+
+if [ ! -d "$WINE_SOURCE_DIR" ]; then
+  WINE_SOURCE_DIR="c:/users/fred/My Documents/My Games"
+fi
+if [ ! -d "$WINE_SOURCE_DIR" ]; then
+  echo "Failing to find the game save directories."
+  exit 1
+fi
+
+# copies the files for a particular game out to a spooling folder.
+function copyem()
+{
+  game_name="$1"; shift
+  source_dir="$1"; shift
+  out_dir="$1"; shift
+
+  if [ -d "$source_dir" ]; then
+    echo $game_name
+    cp -v -n "$source_dir"/* "$out_dir"/
+    sep 28
+  fi
+}
+
+# make the output folders if they don't exist.
+for i in skyrim fallout_new_vegas fallout_3 oblivion fallout_4 ; do
+  if [ ! -d "$SPOOLING_OUTPUT_DIR/$i" ]; then
+    mkdir -p "$SPOOLING_OUTPUT_DIR/$i"
   fi
 done
-echo "======="
-echo skyrim
-cp -v -n ~/wine_goods/My\ Games/Skyrim/Saves/* ~/spooling_saves/skyrim/
-echo "======="
-echo fallout new vegas
-cp -v -n ~/wine_goods/My\ Games/FalloutNV/Saves/* ~/spooling_saves/fallout_new_vegas/
-echo "======="
-echo fallout 3
-cp -v -n ~/wine_goods/My\ Games/Fallout3/Saves/Player1/* ~/spooling_saves/fallout_3/
-echo "======="
-echo oblivion
-cp -v -n ~/wine_goods/My\ Games/Oblivion/Saves/* ~/spooling_saves/oblivion/
-echo "======="
+
+# now run through and copy our save files from the potentially weird locations
+# they reside in.
+
+#hmmm: at least make a function out of those repetitive steps.  sheesh.
+
+sep 28
+
+copyem "skyrim" "$WINE_SOURCE_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
+
+copyem "fallout new vegas" "$WINE_SOURCE_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
+
+copyem "fallout 3" "$WINE_SOURCE_DIR/Fallout3/Saves/Player1" "$SPOOLING_OUTPUT_DIR/fallout_3"
+
+copyem "oblivion" "$WINE_SOURCE_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
+
+copyem "fallout 4" "$WINE_SOURCE_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout_4/Saves"
+
+