From b32b908eaed1ac0330100ba7a7f64be1b4cd5b1b Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Nov 2021 18:28:02 +0100 Subject: [PATCH] App: keep custom user data path as is if FREECAD_USER_HOME or FREECAD_USER_DATA is set --- src/App/Application.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 1db585f346..8cd9248a3d 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -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()) {