updated paths
This commit is contained in:
@@ -11,7 +11,7 @@ QDebug debug_out(&debug_file);
|
||||
|
||||
void setup_debug() {
|
||||
#ifndef QT_DEBUG
|
||||
debug_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/debug_log");
|
||||
debug_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/debug_log");
|
||||
if (debug_file.open(QFile::WriteOnly)) {
|
||||
QString debug_intro = "Olive Session " + QString::number(QDateTime::currentMSecsSinceEpoch());
|
||||
debug_file.write(debug_intro.toUtf8());
|
||||
|
||||
+19
-10
@@ -9,17 +9,26 @@ QString real_app_dir;
|
||||
|
||||
QString get_app_dir() {
|
||||
if (real_app_dir.isEmpty()) {
|
||||
QString app_path = QCoreApplication::applicationFilePath();
|
||||
real_app_dir = app_path.left(app_path.lastIndexOf('/'));
|
||||
}
|
||||
return real_app_dir;
|
||||
QString app_path = QCoreApplication::applicationFilePath();
|
||||
real_app_dir = app_path.left(app_path.lastIndexOf('/'));
|
||||
}
|
||||
return real_app_dir;
|
||||
}
|
||||
|
||||
QString get_data_path() {
|
||||
QString app_dir = get_app_dir();
|
||||
if (QFileInfo::exists(app_dir + "/portable")) {
|
||||
return app_dir;
|
||||
} else {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
}
|
||||
QString app_dir = get_app_dir();
|
||||
if (QFileInfo::exists(app_dir + "/portable")) {
|
||||
return app_dir;
|
||||
} else {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||
}
|
||||
}
|
||||
|
||||
QString get_config_path() {
|
||||
QString app_dir = get_app_dir();
|
||||
if (QFileInfo::exists(app_dir + "/portable")) {
|
||||
return app_dir;
|
||||
} else {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
|
||||
QString get_app_dir();
|
||||
QString get_data_path();
|
||||
QString get_config_path();
|
||||
|
||||
#endif // PATH_H
|
||||
|
||||
+9
-3
@@ -187,9 +187,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
config_dir = data_dir + "/config.xml";
|
||||
config.load(config_dir);
|
||||
}
|
||||
}
|
||||
QString config_path = get_config_path();
|
||||
if (!config_path.isEmpty()) {
|
||||
QDir config_dir(config_path);
|
||||
config_dir.mkpath(".");
|
||||
QString config_fn = config_path + "/config.xml";
|
||||
if (QFileInfo::exists(config_fn)) {
|
||||
config.load(config_fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user