Last active
April 17, 2025 21:36
-
-
Save cwqt/3ac359c34d4da61c8b41b7afbaf44263 to your computer and use it in GitHub Desktop.
Background task that can detect SQLite files created by iOS simulator and symlink them to ~/ for easier/consistent access
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 | |
| echo "Simulated device database symlinker is running..." | |
| db_name="heavyduty.db" | |
| link_target="~/sqlite.db" | |
| while true; do | |
| cd /Users/$(whoami)/Library/Developer/CoreSimulator/Devices/ | |
| random_path=$(find . -type f -name $db_name) | |
| if [[ -n "$random_path" ]]; then | |
| current_link=$(readlink "$link_target") | |
| new_target="/Users/$(whoami)/Library/Developer/CoreSimulator/Devices/$random_path" | |
| if [[ "$current_link" != "$new_target" ]]; then | |
| echo "Symlinking $random_path to $link_target ..." | |
| ln -sf "$new_target" "$link_target" | |
| fi | |
| else | |
| echo "$db_name not found, retrying..." | |
| fi | |
| sleep 5 | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment