diff --git a/linphone-desktop/src/app/paths/Paths.cpp b/linphone-desktop/src/app/paths/Paths.cpp index 2ecdb0096..9f8983faa 100644 --- a/linphone-desktop/src/app/paths/Paths.cpp +++ b/linphone-desktop/src/app/paths/Paths.cpp @@ -64,10 +64,6 @@ inline bool filePathExists (const QString &path) { return file.exists(); } -inline bool filePathExists (const string &path) { - return filePathExists(Utils::linphoneStringToQString(path)); -} - inline void ensureDirPathExists (const QString &path) { QDir dir(path); if (!dir.exists() && !dir.mkpath(path)) @@ -160,6 +156,12 @@ inline QString getAppMessageHistoryFilePath () { // ----------------------------------------------------------------------------- +bool Paths::filePathExists (const string &path) { + return filePathExists(Utils::linphoneStringToQString(path)); +} + +// ----------------------------------------------------------------------------- + string Paths::getAssistantConfigDirPath () { return getReadableDirPath(getAppAssistantConfigDirPath()); } diff --git a/linphone-desktop/src/app/paths/Paths.hpp b/linphone-desktop/src/app/paths/Paths.hpp index 1f86b0d7e..e6bbda9a6 100644 --- a/linphone-desktop/src/app/paths/Paths.hpp +++ b/linphone-desktop/src/app/paths/Paths.hpp @@ -30,6 +30,8 @@ // ============================================================================= namespace Paths { + bool filePathExists (const std::string &path); + std::string getAssistantConfigDirPath (); std::string getAvatarsDirPath (); std::string getCallHistoryFilePath (); diff --git a/linphone-desktop/src/components/core/CoreManager.cpp b/linphone-desktop/src/components/core/CoreManager.cpp index cc0e5cca4..684e34f8d 100644 --- a/linphone-desktop/src/components/core/CoreManager.cpp +++ b/linphone-desktop/src/components/core/CoreManager.cpp @@ -103,10 +103,15 @@ void CoreManager::setDatabasesPaths () { } void CoreManager::setOtherPaths () { - // Force paths. Ask me why if it's a problem for you. - mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath()); - mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath()); - mCore->setRootCa(Paths::getRootCaFilePath()); + if (mCore->getZrtpSecretsFile().empty() || !Paths::filePathExists(mCore->getZrtpSecretsFile())) { + mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath()); + } + if (mCore->getUserCertificatesPath().empty() || !Paths::filePathExists(mCore->getUserCertificatesPath())) { + mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath()); + } + if (mCore->getRootCa().empty() || !Paths::filePathExists(mCore->getRootCa())) { + mCore->setRootCa(Paths::getRootCaFilePath()); + } } void CoreManager::setResourcesPaths () {