Remove legacy config file migration code for mac.
This commit is contained in:
parent
7fc733fca1
commit
6cadc9321d
@ -28,7 +28,6 @@ QString GetResourcesPath();
|
||||
QString GetApplicationSupportPath();
|
||||
QString GetMusicDirectory();
|
||||
|
||||
bool MigrateLegacyConfigFiles();
|
||||
void EnableFullScreen(const QWidget& main_window);
|
||||
|
||||
} // namespace mac
|
||||
|
@ -332,42 +332,6 @@ QString GetMusicDirectory() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MigrateLegacyConfigFiles() {
|
||||
bool moved_dir = false;
|
||||
QString old_config_dir = QString("%1/.config/%2").arg(
|
||||
QDir::homePath(), QCoreApplication::organizationName());
|
||||
if (QFile::exists(old_config_dir)) {
|
||||
QString new_config_dir = Utilities::GetConfigPath(Utilities::Path_Root);
|
||||
// Create ~/Library/Application Support which should already exist anyway.
|
||||
QDir::root().mkpath(GetApplicationSupportPath());
|
||||
|
||||
qLog(Debug) << "Move from:" << old_config_dir
|
||||
<< "to:" << new_config_dir;
|
||||
|
||||
NSFileManager* file_manager = [[NSFileManager alloc] init];
|
||||
NSError* error;
|
||||
bool ret = [file_manager moveItemAtPath:
|
||||
[NSString stringWithUTF8String: old_config_dir.toUtf8().constData()]
|
||||
toPath:[NSString stringWithUTF8String: new_config_dir.toUtf8().constData()]
|
||||
error: &error];
|
||||
if (!ret) {
|
||||
qLog(Warning) << [[error localizedDescription] UTF8String];
|
||||
}
|
||||
moved_dir = true;
|
||||
}
|
||||
|
||||
QString old_config_path = QDir::homePath() + "/Library/Preferences/com.davidsansome.Clementine.plist";
|
||||
if (QFile::exists(old_config_path)) {
|
||||
QSettings settings;
|
||||
bool ret = QFile::rename(old_config_path, settings.fileName());
|
||||
if (ret) {
|
||||
qLog(Warning) << "Migrated old config file: " << old_config_path << "to: " << settings.fileName();
|
||||
}
|
||||
}
|
||||
|
||||
return moved_dir;
|
||||
}
|
||||
|
||||
static int MapFunctionKey(int keycode) {
|
||||
switch (keycode) {
|
||||
// Function keys
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -243,19 +243,6 @@ int main(int argc, char *argv[]) {
|
||||
#ifdef Q_OS_DARWIN
|
||||
// Must happen after QCoreApplication::setOrganizationName().
|
||||
setenv("XDG_CONFIG_HOME", Utilities::GetConfigPath(Utilities::Path_Root).toLocal8Bit().constData(), 1);
|
||||
if (mac::MigrateLegacyConfigFiles()) {
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(Utilities::GetConfigPath(
|
||||
Utilities::Path_Root) + "/" + Database::kDatabaseFilename);
|
||||
db.open();
|
||||
QSqlQuery query(
|
||||
"UPDATE songs SET art_manual = replace("
|
||||
"art_manual, '.config', 'Library/Application Support') "
|
||||
"WHERE art_manual LIKE '%.config%'", db);
|
||||
query.exec();
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(db.connectionName());
|
||||
}
|
||||
#endif
|
||||
|
||||
// This makes us show up nicely in gnome-volume-control
|
||||
|
Loading…
x
Reference in New Issue
Block a user