App: keep custom user data path as is if FREECAD_USER_HOME or FREECAD_USER_DATA is set

This commit is contained in:
wmayer
2021-11-08 18:28:02 +01:00
parent dbd3e8784a
commit b32b908eae

View File

@@ -2958,11 +2958,16 @@ void Application::ExtractUserPath()
// User data path
//
if (userData.isEmpty()) {
userData = getDefaultUserData(userHome);
QString dataPath = userData;
if (dataPath.isEmpty()) {
dataPath = getDefaultUserData(userHome);
}
boost::filesystem::path appData(stringToPath(userData.toStdString()));
getUserData(appData);
boost::filesystem::path appData(stringToPath(dataPath.toStdString()));
// If a custom user data path is given then don't modify it
if (userData.isEmpty())
getUserData(appData);
if (!boost::filesystem::exists(appData)) {
// This should never ever happen
throw Base::FileSystemError("Application data directory " + appData.string() + " does not exist!");
@@ -2971,7 +2976,10 @@ void Application::ExtractUserPath()
// In the second step we want the directory where user settings of the application can be
// kept. There we create a directory with name of the vendor and a sub-directory with name
// of the application.
getApplicationData(mConfig, appData);
//
// If a custom user data path is given then don't modify it
if (userData.isEmpty())
getApplicationData(mConfig, appData);
// In order to write to our data path, we must create some directories, first.
if (!boost::filesystem::exists(appData) && !Py_IsInitialized()) {