From f59f88a688e4ad8900714b35d3279c69b32c5854 Mon Sep 17 00:00:00 2001 From: gaelle Date: Tue, 1 Apr 2025 16:52:09 +0200 Subject: [PATCH] create root ca directory if does not exist --- Linphone/core/path/Paths.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Linphone/core/path/Paths.cpp b/Linphone/core/path/Paths.cpp index 3f344895..a9773737 100644 --- a/Linphone/core/path/Paths.cpp +++ b/Linphone/core/path/Paths.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "tool/Constants.hpp" +#include "tool/Utils.hpp" #include "Paths.hpp" @@ -163,9 +164,21 @@ static inline QString getAppRootCaFilePath() { if (Paths::filePathExists(rootca)) { // Packaged return rootca; } else { + qDebug() << "Root ca path does not exist. Create it"; + QFileInfo rootcaInfo(rootca); + if (!rootcaInfo.absoluteDir().exists()) { + QDir dataDir(getAppPackageDataDirPath()); + if (!dataDir.mkpath(Constants::PathRootCa)) { + lCritical() << "ERROR : COULD NOT CREATE DIRECTORY WITH PATH" << Constants::PathRootCa; + return ""; + } + } QFile rootCaFile(rootca); if (rootCaFile.open(QIODevice::ReadWrite)) return rootca; + else { + lCritical() << "ERROR : COULD NOT CREATE ROOTCA WITH PATH" << rootca; + } } return ""; }