build: split user and data folder, moving user data to Application Support on Mac

This commit is contained in:
Eberhard Graether
2016-02-16 16:44:42 +01:00
parent 89b8d51ab8
commit 86cf1ee62d
51 changed files with 176 additions and 1809 deletions
@@ -1,12 +1,13 @@
#ifndef INCLUDES_DEFAULT_H
#define INCLUDES_DEFAULT_H
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
#include "utility/UserPaths.h"
void setup(int argc, char *argv[])
{
std::string userdir(std::getenv("HOME"));
userdir.append("/.config/coati/");
UserPaths::setUserDataPath(userdir);
}
#endif // INCLUDES_DEFAULT_H
+19 -3
View File
@@ -4,10 +4,10 @@
#include <CoreFoundation/CoreFoundation.h>
#include <QApplication>
#include <QDir>
#include <QStandardPaths>
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
#include "qt/utility/utilityQt.h"
#include "utility/UserPaths.h"
void setup(int argc, char *argv[])
{
@@ -47,6 +47,22 @@ void setup(int argc, char *argv[])
// printf("after change, libraryPaths=(%s)\n", QCoreApplication::libraryPaths().join(",").toUtf8().data());
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Makes the mac bundle copy the user files to the Application Support folder
QString dataPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
QDir dataDir(dataPath);
if (!dataDir.exists())
{
dataDir.mkpath(dataPath);
}
utility::copyNewFilesFromDirectory(QString::fromStdString(UserPaths::getUserDataPath()), dataPath);
UserPaths::setUserDataPath(dataPath.toStdString() + "/");
// ----------------------------------------------------------------------------
}
#endif // INCLUDES_MAC_H
@@ -5,21 +5,15 @@
#include "vld.h"
// #define DEPLOY
#include "utility/UserPaths.h"
#ifdef DEPLOY
static std::string appSettingsPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/ApplicationSettings.xml";
static std::string windowSettingsPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/window_settings.ini";
static std::string logPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/log/";
#else
static std::string appSettingsPath = "data/ApplicationSettings.xml";
static std::string windowSettingsPath = "data/window_settings.ini";
static std::string logPath = "data/log/";
#endif
// #define DEPLOY
void setup(int argc, char *argv[])
{
#ifdef DEPLOY
UserPaths::setUserDataPath(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/");
#endif
}
#endif // INCLUDES_WINDOWS_H