forked from JonathanTroyer/Progress-Renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·137 lines (116 loc) · 4.21 KB
/
install.sh
File metadata and controls
executable file
·137 lines (116 loc) · 4.21 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
# ################ Mod build and install script (Unix version) ################
#
# Cross-platform deployment script for RimWorld mods
# Call this script from your build process or run manually:
# ./install.sh [Debug|Release] [project_dir] [project_name] [folders] [files]
#
# Auto-detects Steam installation on macOS and Linux
# Falls back to user-provided paths if auto-detection fails
set -e # Exit on any error
# Configuration
CONFIG=${1:-Release}
SOLUTION_DIR=${2:-$(pwd)/}
PROJECT_NAME=${3:-Progress-Renderer}
FOLDERS=${4:-"About Common v1.4 v1.5 v1.6"}
FILES=${5:-"LoadFolders.xml"}
# Ensure SOLUTION_DIR ends with /
if [[ ! "$SOLUTION_DIR" =~ /$ ]]; then
SOLUTION_DIR="${SOLUTION_DIR}/"
fi
echo "Configuration: $CONFIG"
echo "Solution Directory: $SOLUTION_DIR"
echo "Project Name: $PROJECT_NAME"
# Function to detect Steam installation
detect_steam_path() {
local steam_path=""
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
local possible_paths=(
"$HOME/Library/Application Support/Steam/steamapps/common"
"/Applications/Steam.app/Contents/MacOS/steamapps/common"
"/Users/Shared/Steam/steamapps/common"
)
else
# Linux
local possible_paths=(
"$HOME/.steam/steam/steamapps/common"
"$HOME/.local/share/Steam/steamapps/common"
"/usr/games/steamapps/common"
"/opt/steam/steamapps/common"
)
fi
for path in "${possible_paths[@]}"; do
if [[ -d "$path/RimWorld" ]]; then
steam_path="$path"
break
fi
done
echo "$steam_path"
}
# Detect or set RimWorld directory
STEAM_DIR=$(detect_steam_path)
if [[ -n "$STEAM_DIR" && -d "$STEAM_DIR/RimWorld" ]]; then
RIMWORLD_DIR_STEAM="$STEAM_DIR/RimWorld"
echo "Auto-detected RimWorld Steam installation: $RIMWORLD_DIR_STEAM"
# Check if RimWorldMac.app exists (macOS packaged version)
if [[ -d "$RIMWORLD_DIR_STEAM/RimWorldMac.app" ]]; then
TARGET_DIR="$RIMWORLD_DIR_STEAM/RimWorldMac.app/Mods/$PROJECT_NAME"
echo "Using macOS packaged mods directory: $TARGET_DIR"
else
TARGET_DIR="$RIMWORLD_DIR_STEAM/Mods/$PROJECT_NAME"
echo "Using standard mods directory: $TARGET_DIR"
fi
else
echo "Could not auto-detect RimWorld installation."
echo "Please set RIMWORLD_DIR_STEAM environment variable to your RimWorld installation path."
echo "Example paths:"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo " export RIMWORLD_DIR_STEAM=\"$HOME/Library/Application Support/Steam/steamapps/common/RimWorld\""
else
echo " export RIMWORLD_DIR_STEAM=\"$HOME/.steam/steam/steamapps/common/RimWorld\""
fi
if [[ -z "$RIMWORLD_DIR_STEAM" ]]; then
echo "Exiting: No RimWorld installation found and RIMWORLD_DIR_STEAM not set."
exit 1
fi
# Check if manually set path includes RimWorldMac.app
if [[ -d "$RIMWORLD_DIR_STEAM/RimWorldMac.app" ]]; then
TARGET_DIR="$RIMWORLD_DIR_STEAM/RimWorldMac.app/Mods/$PROJECT_NAME"
else
TARGET_DIR="$RIMWORLD_DIR_STEAM/Mods/$PROJECT_NAME"
fi
fi
# Remove the duplicate TARGET_DIR assignment since it's now set above
echo "Target directory: $TARGET_DIR"
# Create target directory if it doesn't exist
mkdir -p "$TARGET_DIR"
# Copy folders
echo "Copying mod folders..."
for folder in $FOLDERS; do
if [[ -d "$SOLUTION_DIR$folder" ]]; then
echo " Copying $folder..."
cp -r "$SOLUTION_DIR$folder" "$TARGET_DIR/"
else
echo " Warning: Folder $folder not found, skipping..."
fi
done
# Copy files
echo "Copying mod files..."
for file in $FILES; do
if [[ -f "$SOLUTION_DIR$file" ]]; then
echo " Copying $file..."
cp "$SOLUTION_DIR$file" "$TARGET_DIR/"
else
echo " Warning: File $file not found, skipping..."
fi
done
echo "Mod installation completed successfully!"
echo "Mod installed to: $TARGET_DIR"
# Optional: Create archive (if zip is available)
if command -v zip >/dev/null 2>&1; then
echo "Creating archive..."
cd "$(dirname "$TARGET_DIR")"
zip -r "${PROJECT_NAME}.zip" "$PROJECT_NAME" >/dev/null 2>&1
echo "Archive created: $(dirname "$TARGET_DIR")/${PROJECT_NAME}.zip"
fi