Created
July 9, 2012 19:23
-
-
Save mronkko/3078345 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Locate profile directory. | |
if [ -e ~/Library/Application\ Support/Zotero/profiles.ini ] | |
then | |
echo "Found Zotero Standalone profile" | |
PROFILEBASE=~/Library/Application\ Support/Zotero/ | |
elif [ -e ~/Library/Application\ Support/Firefox/profiles.ini ] | |
then | |
echo "Found Firefox profile" | |
PROFILEBASE=~/Library/Application\ Support/Firefox/ | |
else | |
echo "Could not locate Firefox or Zotero Standalone profile" | |
exit 1 | |
fi | |
# Parse the default profile | |
DEFAULTPROFILE="$PROFILEBASE`cat "$PROFILEBASE/profiles.ini" | grep -B 1 "Default=1" | head -n1 | sed 's/Path=//'`" | |
# Parse preferences | |
if [ -e "$DEFAULTPROFILE/prefs.js" ] | |
then | |
cat "$DEFAULTPROFILE/prefs.js" | grep "extensions.zotero.dataDir" | sed 's/user_pref(\"extensions.zotero.dataDir\", \"\(.*\)\");/\1/' | |
else | |
echo "Could not read Zotero preferences" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment