-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathcopy-world.sh
executable file
·45 lines (40 loc) · 1.07 KB
/
copy-world.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#################################################
# Copies world to/from game files
#################################################
TARGET_DIR="$HOME/.local/share/Terraria/tModLoader/Worlds"
TO_FLAG=0
FROM_FLAG=0
MNT_FLAG=0
for arg in "$@"
do
case $arg in
-t|--to)
TO_FLAG=1
;;
-f|--from)
FROM_FLAG=1
;;
--mnt)
MNT_FLAG=1
;;
*)
echo "Invalid option: $arg"
echo "Supply either --to or --from and optionally --mnt to specify directory"
exit 1
;;
esac
done
if [ "$MNT_FLAG" -eq 1 ]; then
TARGET_DIR="/mnt/d/computerraria"
fi
if [ "$TO_FLAG" -eq 1 ]; then
cp $(dirname "$0")/computerraria.wld $TARGET_DIR
cp $(dirname "$0")/computerraria.twld $TARGET_DIR
elif [ "$FROM_FLAG" -eq 1 ]; then
cp "$TARGET_DIR/computerraria.wld" $(dirname "$0")
cp "$TARGET_DIR/computerraria.twld" $(dirname "$0")
else
echo "Supply either --to or --from to copy either to or from the Terraria world files"
exit 1
fi