| 3543 | } |
| 3544 | |
| 3545 | void Application::ExtractUserPath() |
| 3546 | { |
| 3547 | bool keepDeprecatedPaths = mConfig.contains("KeepDeprecatedPaths"); |
| 3548 | |
| 3549 | // std paths |
| 3550 | mConfig["BinPath"] = mConfig["AppHomePath"] + "bin" + PATHSEP; |
| 3551 | mConfig["DocPath"] = mConfig["AppHomePath"] + "doc" + PATHSEP; |
| 3552 | |
| 3553 | // this is to support a portable version of FreeCAD |
| 3554 | auto paths = getCustomPaths(); |
| 3555 | QString customHome = std::get<0>(paths); |
| 3556 | QString customData = std::get<1>(paths); |
| 3557 | QString customTemp = std::get<2>(paths); |
| 3558 | |
| 3559 | // get the system standard paths |
| 3560 | auto stdPaths = getStandardPaths(); |
| 3561 | QString configHome = std::get<0>(stdPaths); |
| 3562 | QString dataHome = std::get<1>(stdPaths); |
| 3563 | QString cacheHome = std::get<2>(stdPaths); |
| 3564 | QString tempPath = std::get<3>(stdPaths); |
| 3565 | |
| 3566 | // User home path |
| 3567 | // |
| 3568 | QString homePath = findUserHomePath(customHome); |
| 3569 | mConfig["UserHomePath"] = homePath.toUtf8().data(); |
| 3570 | |
| 3571 | // the old path name to save config and data files |
| 3572 | std::vector<std::string> subdirs; |
| 3573 | if (keepDeprecatedPaths) { |
| 3574 | configHome = homePath; |
| 3575 | dataHome = homePath; |
| 3576 | cacheHome = homePath; |
| 3577 | getOldDataLocation(mConfig, subdirs); |
| 3578 | } |
| 3579 | else { |
| 3580 | getSubDirectories(mConfig, subdirs); |
| 3581 | } |
| 3582 | |
| 3583 | // User data path |
| 3584 | // |
| 3585 | std::filesystem::path data = findPath(dataHome, customData, subdirs, true); |
| 3586 | mConfig["UserAppData"] = Base::FileInfo::pathToString(data) + PATHSEP; |
| 3587 | |
| 3588 | |
| 3589 | // User config path |
| 3590 | // |
| 3591 | std::filesystem::path config = findPath(configHome, customHome, subdirs, true); |
| 3592 | mConfig["UserConfigPath"] = Base::FileInfo::pathToString(config) + PATHSEP; |
| 3593 | |
| 3594 | |
| 3595 | // User cache path |
| 3596 | // |
| 3597 | std::vector<std::string> cachedirs = subdirs; |
| 3598 | cachedirs.emplace_back("Cache"); |
| 3599 | std::filesystem::path cache = findPath(cacheHome, customTemp, cachedirs, true); |
| 3600 | mConfig["UserCachePath"] = Base::FileInfo::pathToString(cache) + PATHSEP; |
| 3601 | |
| 3602 |
nothing calls this directly
no test coverage detected