Only override zrtp secrets, user certificates and root ca paths if they are empty or that the file does not exist.

This commit is contained in:
Ghislain MARY 2017-05-29 16:27:14 +02:00
parent a064407f53
commit cadaec54c6
3 changed files with 17 additions and 8 deletions

View file

@ -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());
}

View file

@ -30,6 +30,8 @@
// =============================================================================
namespace Paths {
bool filePathExists (const std::string &path);
std::string getAssistantConfigDirPath ();
std::string getAvatarsDirPath ();
std::string getCallHistoryFilePath ();

View file

@ -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 () {