final fix to perplexing name issue, i hope
[feisty_meow.git] / scripts / customize / fred / scripts / games / gamesaver.sh
index 43aa8d411a2b6bdc8ab94adad9654422f2f30c71..2beec56d4ca214b77eb29e21dced2fc40c3ebc6b 100644 (file)
@@ -5,22 +5,22 @@
 
 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 
-#we are missing the netcp thing.  why????
+WINE_GOODS_DIR="$HOME/wine_goods"
+if [ ! -d "$WINE_GOODS_DIR" ]; then
+  WINE_GOODS_DIR="/cygdrive/c/users/fred/My Documents"
+fi
 
-WINE_SOURCE_DIR="$HOME/wine_goods/My Games"
+WINE_GAMES_DIR="$WINE_GOODS_DIR/My Games"
 SPOOLING_OUTPUT_DIR="$HOME/data/spooling_saves"
 
-if [ ! -d "$WINE_SOURCE_DIR" ]; then
-  WINE_SOURCE_DIR="/cygdrive/c/users/fred/My Documents/My Games"
-fi
-if [ ! -d "$WINE_SOURCE_DIR" ]; then
+if [ ! -d "$WINE_GAMES_DIR" ]; then
   echo "Failing to find the game save directories."
   exit 1
 fi
 
 if [ ! -d "$SPOOLING_OUTPUT_DIR" ]; then
   mkdir -p "$SPOOLING_OUTPUT_DIR"
-  check_result Creating spooling output directory.
+  exit_on_error Creating spooling output directory.
 fi
 
 # copies the files for a particular game out to a spooling folder.
@@ -32,32 +32,32 @@ function copyem()
 
   if [ -d "$source_dir" ]; then
     echo $game_name
-#old    cp -v -n "$source_dir"/* "$out_dir"/
+    if [ ! -d "$out_dir" ]; then
+      mkdir -p "$out_dir"
+      exit_on_error "Creating storage dir: $out_dir"
+    fi
     netcp "$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/Saves oblivion fallout_4/Saves ; do
-  if [ ! -d "$SPOOLING_OUTPUT_DIR/$i" ]; then
-    mkdir -p "$SPOOLING_OUTPUT_DIR/$i"
-  fi
-done
+##############
 
 # now run through and copy our save files from the potentially weird locations
 # they reside in.
 
 sep 28
 
-copyem "skyrim" "$WINE_SOURCE_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
+copyem "skyrim" "$WINE_GAMES_DIR/Skyrim/Saves" "$SPOOLING_OUTPUT_DIR/skyrim"
+
+copyem "fallout new vegas" "$WINE_GAMES_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
 
-copyem "fallout new vegas" "$WINE_SOURCE_DIR/FalloutNV/Saves" "$SPOOLING_OUTPUT_DIR/fallout_new_vegas"
+copyem "fallout 3" "$WINE_GAMES_DIR/Fallout3/Saves" "$SPOOLING_OUTPUT_DIR/fallout_3"
 
-copyem "fallout 3" "$WINE_SOURCE_DIR/Fallout3/Saves" "$SPOOLING_OUTPUT_DIR/fallout_3/Saves"
+copyem "oblivion" "$WINE_GAMES_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
 
-copyem "oblivion" "$WINE_SOURCE_DIR/Oblivion/Saves" "$SPOOLING_OUTPUT_DIR/oblivion/"
+copyem "fallout 4" "$WINE_GAMES_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout_4"
 
-copyem "fallout 4" "$WINE_SOURCE_DIR/Fallout4/Saves" "$SPOOLING_OUTPUT_DIR/fallout_4/Saves"
+copyem "witcher 3" "$WINE_GOODS_DIR/The Witcher 3/gamesaves" "$SPOOLING_OUTPUT_DIR/witcher_3"