Browse Source

Added case for `/Application Support/Tox` already existing

I tried to get it done without bash… But this was the simplest method
that works for this special case scenerio.
pull/2822/head
Rowen Stipe 10 years ago
parent
commit
a05310e155
  1. 9
      OSX-Migrater.sh
  2. 3
      qtox.pro
  3. 13
      src/platform/install_osx.cpp

9
OSX-Migrater.sh

@ -1,14 +1,17 @@ @@ -1,14 +1,17 @@
#!/usr/bin/env bash
# A qTox profile migrater for OSX
now=$(date +"%m_%d_%Y-%H.%M.%S")
bak="~/.Tox-Backup-$now"
echo "Figuring out if action is required ..."
if [ -d ~/Library/Prefrences/tox]
if [ -d ~/Library/Preferences/tox ]; then
echo "Moving profile(s) ..."
cp -r ~/Library/Preferences/tox ~/Library/Application\ Support/
mv ~/Library/Application\ Support/tox/ ~/Library/Application\ Support/Tox
mv ~/Library/Preferences/tox ~/.Tox-Backup
mv ~/Library/Preferences/tox ~/.Tox-Backup-$now
echo "Done! You profile(s) have been moved! A back up coppy still exists at:"
echo "~/.Tox-Backup"
echo "$bak"
else
echo "Cannot locate old profile directory, profile migration not performed"
fi

3
qtox.pro

@ -165,7 +165,8 @@ win32 { @@ -165,7 +165,8 @@ win32 {
contains(DEFINES, QTOX_PLATFORM_EXT) { LIBS += -framework IOKit -framework CoreFoundation }
contains(DEFINES, QTOX_FILTER_AUDIO) { LIBS += -lfilteraudio }
#Files to be includes into the qTox.app/Contents/Resources folder
APP_RESOURCE.files = img/icons/qtox_profile.icns
#OSX-Migrater.sh part of migrateProfiles() compatabilty code
APP_RESOURCE.files = img/icons/qtox_profile.icns OSX-Migrater.sh
APP_RESOURCE.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_RESOURCE
#Dynamic versioning for Info.plist

13
src/platform/install_osx.cpp

@ -84,7 +84,7 @@ void osx::moveToAppFolder() @@ -84,7 +84,7 @@ void osx::moveToAppFolder()
}
}
}
// migrateProfiles() is compatabilty code that can be removed down the line when the time seems right.
void osx::migrateProfiles()
{
QString oldPath = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() +
@ -100,7 +100,15 @@ void osx::migrateProfiles() @@ -100,7 +100,15 @@ void osx::migrateProfiles()
qDebug() << "OS X: Old settings directory detected migrating to default";
if( !dir.rename(oldPath, newPath) )
{
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already exists.";
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already exists. Using alternate migration method.";
QString OSXMigrater = "../Resources/OSX-Migrater.sh" ;
QProcess::execute(OSXMigrater);
QMessageBox MigrateProfile;
MigrateProfile.setIcon(QMessageBox::Information);
MigrateProfile.setWindowModality(Qt::ApplicationModal);
MigrateProfile.setText("Alternate profile migration method used.");
MigrateProfile.setInformativeText("It has been detected that your profiles \nwhere migrated to the new settings directory; \nusing the alternate migration method. \n\nA backup can be found in your: \n/Users/[USER]/.Tox-Backup[DATE-TIME] \n\nJust in case. \r\n");
MigrateProfile.exec();
}
}
else
@ -108,3 +116,4 @@ void osx::migrateProfiles() @@ -108,3 +116,4 @@ void osx::migrateProfiles()
qDebug() << "OS X: Old settings directory not detected";
}
}
// End migrateProfiles() compatibility code

Loading…
Cancel
Save