1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

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.
This commit is contained in:
Rowen Stipe 2016-01-20 01:22:25 -05:00
parent 27fda2e579
commit a05310e155
3 changed files with 19 additions and 6 deletions

View File

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

View File

@ -165,7 +165,8 @@ win32 {
contains(DEFINES, QTOX_PLATFORM_EXT) { LIBS += -framework IOKit -framework CoreFoundation } contains(DEFINES, QTOX_PLATFORM_EXT) { LIBS += -framework IOKit -framework CoreFoundation }
contains(DEFINES, QTOX_FILTER_AUDIO) { LIBS += -lfilteraudio } contains(DEFINES, QTOX_FILTER_AUDIO) { LIBS += -lfilteraudio }
#Files to be includes into the qTox.app/Contents/Resources folder #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 APP_RESOURCE.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_RESOURCE QMAKE_BUNDLE_DATA += APP_RESOURCE
#Dynamic versioning for Info.plist #Dynamic versioning for Info.plist

View File

@ -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() void osx::migrateProfiles()
{ {
QString oldPath = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + QString oldPath = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() +
@ -100,7 +100,15 @@ void osx::migrateProfiles()
qDebug() << "OS X: Old settings directory detected migrating to default"; qDebug() << "OS X: Old settings directory detected migrating to default";
if( !dir.rename(oldPath, newPath) ) 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 else
@ -108,3 +116,4 @@ void osx::migrateProfiles()
qDebug() << "OS X: Old settings directory not detected"; qDebug() << "OS X: Old settings directory not detected";
} }
} }
// End migrateProfiles() compatibility code