sal/osl/all/log.cxx | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 1339c42c4aea269e5265277647361ae91882d8a5
Author: Stephan Bergmann <[email protected]>
AuthorDate: Fri Mar 22 17:10:51 2024 +0100
Commit: Stephan Bergmann <[email protected]>
CommitDate: Mon Mar 25 12:42:05 2024 +0100
Best effort to create directories of SAL_LOG_FILE
Change-Id: Ia86ac0e022579d155e92de3b853d57860b5b97e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165272
Tested-by: Stephan Bergmann <[email protected]>
Reviewed-by: Stephan Bergmann <[email protected]>
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 3f92e9a62ec9..dd91d4ea2944 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -17,8 +17,10 @@
#include <filesystem>
#include <fstream>
+#include <system_error>
#include <config_global.h>
+#include <o3tl/temporary.hxx>
#include <osl/thread.hxx>
#include <rtl/string.h>
#include <sal/detail/log.h>
@@ -200,6 +202,9 @@ std::ofstream * getLogFile() {
if (logFile)
{
+ std::filesystem::create_directories(
+ std::filesystem::path(logFile).remove_filename(),
+ o3tl::temporary(std::error_code()));
// stays until process exits
static std::ofstream file(logFile, std::ios::app | std::ios::out);
pResult = &file;