diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index d424c66e8..52fa46b41 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -647,6 +647,8 @@ void App::initCore() { SettingsModel::create(); lDebug() << log().arg("Creating SettingsCore"); settings = SettingsCore::create(); + // Update the download folder if set in the configuration file + CoreModel::getInstance()->setPathsAfterCreation(); lDebug() << log().arg("Checking downloaded codecs updates"); Utils::checkDownloadedCodecsUpdates(); lDebug() << log().arg("Setting Video Codec Priority Policy"); diff --git a/Linphone/model/core/CoreModel.cpp b/Linphone/model/core/CoreModel.cpp index ff7e30d63..4f19d150e 100644 --- a/Linphone/model/core/CoreModel.cpp +++ b/Linphone/model/core/CoreModel.cpp @@ -172,12 +172,17 @@ void CoreModel::setPathBeforeCreation() { } void CoreModel::setPathsAfterCreation() { - auto friendsPath = Paths::getFriendsListFilePath(); - if (!friendsPath.isEmpty() && QFileInfo(friendsPath).exists()) { - lInfo() << log().arg("Using old friends database at %1").arg(friendsPath); - std::shared_ptr config = mCore->getConfig(); - config->setString("storage", "friends_db_uri", Utils::appStringToCoreString(friendsPath)); - } + // auto friendsPath = Paths::getFriendsListFilePath(); + // if (!friendsPath.isEmpty() && QFileInfo(friendsPath).exists()) { + // lInfo() << log().arg("Using old friends database at %1").arg(friendsPath); + // std::shared_ptr config = mCore->getConfig(); + // config->setString("storage", "friends_db_uri", Utils::appStringToCoreString(friendsPath)); + // } + std::shared_ptr factory = linphone::Factory::get(); + QString downloadFolder = SettingsModel::getInstance()->getDownloadFolder(); + if (downloadFolder.isEmpty()) downloadFolder = Paths::getDownloadDirPath(); + if (!downloadFolder.endsWith(QDir::separator())) downloadFolder.append(QDir::separator()); + SET_FACTORY_PATH(Download, (downloadFolder)); } void CoreModel::setPathAfterStart() { diff --git a/Linphone/model/core/CoreModel.hpp b/Linphone/model/core/CoreModel.hpp index 85eca27c2..742141f51 100644 --- a/Linphone/model/core/CoreModel.hpp +++ b/Linphone/model/core/CoreModel.hpp @@ -60,6 +60,7 @@ public: void start(); void setConfigPath(QString path); + void setPathsAfterCreation(); void refreshOidcRemainingTime(); @@ -112,7 +113,6 @@ private: bool mCheckVersionRequestedByUser = false; void setPathBeforeCreation(); - void setPathsAfterCreation(); void setPathAfterStart(); static std::shared_ptr gCoreModel;