Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ST3. #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 29 additions & 36 deletions zsh-scripts/bin/setup-sync-sublime-over-dropbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,50 @@ SYNC_FOLDER="$DROPBOX/Sublime"
if [ `uname` = "Darwin" ];then
SOURCE="$HOME/Library/Application Support/Sublime Text 2"
elif [ `uname` = "Linux" ];then
SOURCE="$HOME/.config/sublime-text-2"
if [ -e $HOME/.config/sublime-text-3 ]; then
SOURCE="$HOME/.config/sublime-text-3"
elif [ -e $HOME/.config/sublime-text-2 ]; then
SOURCE="$HOME/.config/sublime-text-2"
else
echo "Unknown SublimeText version"
exit 1
fi
else
echo "Unknown operating system"
exit 1
fi

# Check that settings really exist on this computer
if [ ! -e "$SOURCE/Packages/" ]; then
echo "Could not find $SOURCE/Settings/"
if [ ! -e "$SOURCE/Packages" -o ! -e "$SOURCE/Installed Packages" ]; then
echo "Could not find SublimeText setup files!"
exit 1
fi

# Detect that we don't try to install twice and screw up
if [ -L "$SOURCE/Packages" ] ; then
echo "Dropbox settings already symlinked"
exit 1
# SublimeText has not been set up on Dropbox?
if [ ! -e "$SYNC_FOLDER" ]; then
echo "Setting up Dropbox sync folder"
mkdir -p "$SYNC_FOLDER/"
fi

# XXX: Disabled Settings/ folder syncing as looks like
# Sublime keeps only license and .sublime_session files -
# the latter
# which are autosaved and would cause unnecessary conflicts
# and traffic

# Dropbox has not been set-up on any computer before?
if [ ! -e "$SYNC_FOLDER" ] ; then
echo "Setting up Dropbox sync folder"

# Creating the folders in separated categories
mkdir -p "$SYNC_FOLDER/Installed Packages"
mkdir -p "$SYNC_FOLDER/Packages"
# mkdir -p "$SYNC_FOLDER/Settings"

# Copy the files into their respective folder
cp -r "$SOURCE/Installed Packages/" "$SYNC_FOLDER/Installed Packages"
cp -r "$SOURCE/Packages/" "$SYNC_FOLDER/Packages"
# cp -r "$SOURCE/Settings/" "$SYNC_FOLDER/Settings"
# Dropbox not populated, copy from this computer.
if [ ! -e "$SYNC_FOLDER/Installed Packages" ]; then
cp -r "$SOURCE/Installed Packages" "$SYNC_FOLDER/"
fi
if [ ! -e "$SYNC_FOLDER/Packages" ]; then
cp -r "$SOURCE/Packages" "$SYNC_FOLDER/"
fi

# Now when settings are in Dropbox delete existing files
rm -rf "$SOURCE/Installed Packages"
rm -rf "$SOURCE/Packages"
#rm -rf "$SOURCE/Settings"
# Detect that we don't try to install twice and screw up
if [ -L "$SOURCE/Packages" -o -L "$SOURCE/Installed Packages" ] ; then
echo "Dropbox folders already symlinked"
exit 1
fi

# Symlink settings folders from Drobox
# The "Installed Packages" and "Packages" was never
# created inside of Dropbox folder. These lines are not working.
# Fixed to the correct folder.
# Rename the local copies.
mv "$SOURCE/Installed Packages" "$SOURCE/Installed Packages.old"
mv "$SOURCE/Packages" "$SOURCE/Packages.old"

# Symlink folders from Drobox.
ln -s "$SYNC_FOLDER/Installed Packages" "$SOURCE/Installed Packages"
ln -s "$SYNC_FOLDER/Packages" "$SOURCE/Packages"
#ln -s "$SYNC_FOLDER/Settings" "$SOURCE/Settings"