build: deploy changes

* moved sample projects from data to user folder
* added fallback files for app and window settings
* implemented copying app and window settings to user folder when not found on app startup
* fixed upgrading for windows installer
This commit is contained in:
malte_langkabel
2016-12-14 13:33:17 +01:00
parent 68a2cb08bc
commit 5482e56e82
191 changed files with 279 additions and 241 deletions
+8
View File
@@ -3,6 +3,7 @@
#include "utility/ResourcePaths.h"
#include "utility/Status.h"
#include "utility/utility.h"
#include "utility/UserPaths.h"
const size_t ApplicationSettings::VERSION = 1;
@@ -307,7 +308,14 @@ std::vector<FilePath> ApplicationSettings::getRecentProjects() const
for (FilePath project: loadedRecentProjects)
{
if (project.isAbsolute())
{
recentProjects.push_back(project);
}
else
{
recentProjects.push_back(UserPaths::getSampleProjectsPath() + project.str());
}
}
return recentProjects;
}
+16
View File
@@ -1,6 +1,7 @@
#include "utility/UserPaths.h"
std::string UserPaths::s_userDataPath = "";
std::string UserPaths::s_sampleProjectsPath = "";
std::string UserPaths::getUserDataPath()
{
@@ -12,6 +13,21 @@ void UserPaths::setUserDataPath(const std::string& path)
s_userDataPath = path;
}
std::string UserPaths::getSampleProjectsPath()
{
if (s_sampleProjectsPath.size())
{
return s_sampleProjectsPath;
}
return s_userDataPath;
}
void UserPaths::setSampleProjectsPath(const std::string& path)
{
s_sampleProjectsPath = path;
}
std::string UserPaths::getAppSettingsPath()
{
return getUserDataPath() + "ApplicationSettings.xml";
+4
View File
@@ -9,12 +9,16 @@ public:
static std::string getUserDataPath();
static void setUserDataPath(const std::string& path);
static std::string getSampleProjectsPath();
static void setSampleProjectsPath(const std::string& path);
static std::string getAppSettingsPath();
static std::string getWindowSettingsPath();
static std::string getLogPath();
private:
static std::string s_userDataPath;
static std::string s_sampleProjectsPath;
};
#endif // USER_PATHS_H
@@ -32,7 +32,7 @@ void setupApp(int argc, char *argv[])
dataDir.mkpath(userDataPath);
}
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/usr/" ), userDataPath);
utility::copyNewFilesFromDirectory(QString::fromStdString(AppPath::getAppPath() + "/user/" ), userDataPath);
}
#endif // INCLUDES_DEFAULT_H
+5 -1
View File
@@ -62,7 +62,7 @@ void setupPlatform(int argc, char *argv[])
dataDir.mkpath(dataPath);
}
utility::copyNewFilesFromDirectory(QString::fromStdString(UserPaths::getUserDataPath()), dataPath);
utility::copyNewFilesFromDirectory(QString::fromStdString(UserPaths::getUserDataPath() + "user/"), dataPath);
UserPaths::setUserDataPath(dataPath.toStdString() + "/");
// ----------------------------------------------------------------------------
@@ -79,6 +79,10 @@ void setupApp(int argc, char *argv[])
{
UserPaths::setUserDataPath(path.absolute().str() + "/user/");
}
else
{
UserPaths::setSampleProjectsPath(path.absolute().str() + "/data/");
}
}
#endif // INCLUDES_MAC_H
@@ -6,6 +6,7 @@
#include "vld.h"
#include "utility/file/FileSystem.h"
#include "utility/UserPaths.h"
#include "platform_includes/deploy.h"
@@ -25,6 +26,10 @@ void setupApp(int argc, char *argv[])
path += "/user/";
UserPaths::setUserDataPath(path);
#endif
// These method does nothing if the copy destination already exist
FileSystem::copyFile("data/fallback/ApplicationSettings.xml", UserPaths::getAppSettingsPath());
FileSystem::copyFile("data/fallback/window_settings.ini", UserPaths::getWindowSettingsPath());
}
#endif // INCLUDES_WINDOWS_H