Last active
July 2, 2020 15:31
-
-
Save jwkicklighter/96c650d25f6a9c72af0050782fc56857 to your computer and use it in GitHub Desktop.
Link PrusaSlicer configs from a synced directory to the default config directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| # | |
| # Create symlinks in the PrusaSlicer config directory pointing to the contents of this directory. | |
| SYNC_DIR=`pwd` | |
| CONFIG_DIR="$HOME/Library/Application Support/PrusaSlicer" | |
| dirs="filament print printer" | |
| echo $CONFIG_DIR | |
| echo $SYNC_DIR | |
| for dir in $dirs | |
| do | |
| echo "" | |
| echo linking $dir directory | |
| current_config_dir=$CONFIG_DIR/$dir | |
| if [[ -d $current_config_dir ]]; then | |
| moved_current_config_dir=$current_config_dir.old | |
| echo Directory $current_config_dir already exists, moving it to $moved_current_config_dir | |
| mv "$CONFIG_DIR/$dir" "$CONFIG_DIR/$dir.old" | |
| fi | |
| ln -s "$SYNC_DIR/$dir" "$CONFIG_DIR/$dir" | |
| done | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create symlinks in the PrusaSlicer config directory pointing to the contents of this directory. | |
| # | |
| # Note: Must run as administrator, I take no responsibility for damages! | |
| $sync_location = Get-Location | |
| $sync_dir = $sync_location.path | |
| $config_dir = Join-Path -Path $env:APPDATA -ChildPath "PrusaSlicer" | |
| $paths = "filament", "print", "printer" | |
| ForEach ($path in $paths) { | |
| echo "" | |
| echo "linking $path directory" | |
| $current_config_dir = Join-Path -Path $config_dir -ChildPath $path | |
| $target_sync_dir = Join-Path -Path $sync_dir -ChildPath $path | |
| If (Test-Path -Path $current_config_dir) { | |
| $moved_current_config_dir = $current_config_dir + ".old" | |
| echo "Directory $current_config_dir already exists, moving it to $moved_current_config_dir" | |
| Rename-Item -Path $current_config_dir -NewName $moved_current_config_dir | |
| } | |
| New-Item -ItemType SymbolicLink -Path $current_config_dir -Target $target_sync_dir | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment