2025-03-09 18:09:22 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
# Directory to copy/hardlink mods to
|
2025-03-09 18:09:22 -05:00
|
|
|
TARGET_DIR="${HOME}/.local/share/Paradox Interactive/Stellaris/mod/"
|
|
|
|
|
|
|
|
# Create the target directory if it doesn't exist
|
|
|
|
mkdir -p "$TARGET_DIR"
|
|
|
|
|
|
|
|
# Loop through each subdirectory in the same directory as the script
|
|
|
|
for mod_dir in */; do
|
2025-03-09 19:21:45 -05:00
|
|
|
# Remove trailing slash from directory name
|
|
|
|
mod_name="${mod_dir%/}"
|
2025-03-09 18:09:22 -05:00
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
# Path to the .mod file with the same name as the directory
|
|
|
|
mod_file="${mod_name}.mod"
|
2025-03-09 18:09:22 -05:00
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
# Check if the .mod file exists
|
|
|
|
if [ -f "$mod_file" ]; then
|
|
|
|
echo "Processing mod: $mod_name"
|
2025-03-09 18:09:22 -05:00
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
# Remove existing .mod file if it exists
|
|
|
|
if [ -f "$TARGET_DIR$mod_file" ]; then
|
|
|
|
rm "$TARGET_DIR$mod_file"
|
|
|
|
fi
|
2025-03-09 18:09:22 -05:00
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
# Hardlink the .mod file to the target directory
|
|
|
|
ln "$mod_file" "$TARGET_DIR$mod_file"
|
2025-03-09 18:09:22 -05:00
|
|
|
else
|
|
|
|
echo "Warning: .mod file for $mod_name not found, skipping."
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2025-03-09 19:21:45 -05:00
|
|
|
echo "Mod linking completed."
|