Commit cadaec54 authored by Ghislain MARY's avatar Ghislain MARY

Only override zrtp secrets, user certificates and root ca paths if they are...

Only override zrtp secrets, user certificates and root ca paths if they are empty or that the file does not exist.
parent a064407f
...@@ -64,10 +64,6 @@ inline bool filePathExists (const QString &path) { ...@@ -64,10 +64,6 @@ inline bool filePathExists (const QString &path) {
return file.exists(); return file.exists();
} }
inline bool filePathExists (const string &path) {
return filePathExists(Utils::linphoneStringToQString(path));
}
inline void ensureDirPathExists (const QString &path) { inline void ensureDirPathExists (const QString &path) {
QDir dir(path); QDir dir(path);
if (!dir.exists() && !dir.mkpath(path)) if (!dir.exists() && !dir.mkpath(path))
...@@ -160,6 +156,12 @@ inline QString getAppMessageHistoryFilePath () { ...@@ -160,6 +156,12 @@ inline QString getAppMessageHistoryFilePath () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool Paths::filePathExists (const string &path) {
return filePathExists(Utils::linphoneStringToQString(path));
}
// -----------------------------------------------------------------------------
string Paths::getAssistantConfigDirPath () { string Paths::getAssistantConfigDirPath () {
return getReadableDirPath(getAppAssistantConfigDirPath()); return getReadableDirPath(getAppAssistantConfigDirPath());
} }
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
// ============================================================================= // =============================================================================
namespace Paths { namespace Paths {
bool filePathExists (const std::string &path);
std::string getAssistantConfigDirPath (); std::string getAssistantConfigDirPath ();
std::string getAvatarsDirPath (); std::string getAvatarsDirPath ();
std::string getCallHistoryFilePath (); std::string getCallHistoryFilePath ();
......
...@@ -103,10 +103,15 @@ void CoreManager::setDatabasesPaths () { ...@@ -103,10 +103,15 @@ void CoreManager::setDatabasesPaths () {
} }
void CoreManager::setOtherPaths () { void CoreManager::setOtherPaths () {
// Force paths. Ask me why if it's a problem for you. if (mCore->getZrtpSecretsFile().empty() || !Paths::filePathExists(mCore->getZrtpSecretsFile())) {
mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath()); mCore->setZrtpSecretsFile(Paths::getZrtpSecretsFilePath());
mCore->setUserCertificatesPath(Paths::getUserCertificatesDirPath()); }
mCore->setRootCa(Paths::getRootCaFilePath()); 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 () { void CoreManager::setResourcesPaths () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment