add symlink setup script
This commit is contained in:
parent
95335938d9
commit
1e65506527
1 changed files with 31 additions and 0 deletions
31
setup_symlinks.sh
Executable file
31
setup_symlinks.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Directory to copy/symlink mods to
|
||||
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
|
||||
# Remove trailing slash from directory name
|
||||
mod_name="${mod_dir%/}"
|
||||
|
||||
# Path to the .mod file with the same name as the directory
|
||||
mod_file="${mod_name}.mod"
|
||||
|
||||
# Check if the .mod file exists
|
||||
if [ -f "$mod_file" ]; then
|
||||
echo "Processing mod: $mod_name"
|
||||
|
||||
# Symlink the mod directory to the target directory
|
||||
ln -sfn "$(pwd)/$mod_dir" "$TARGET_DIR$mod_name"
|
||||
|
||||
# Symlink the .mod file to the target directory
|
||||
ln -sfn "$(pwd)/$mod_file" "$TARGET_DIR$mod_file"
|
||||
else
|
||||
echo "Warning: .mod file for $mod_name not found, skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Mod copying/symlinking completed."
|
Loading…
Add table
Add a link
Reference in a new issue