diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-22 17:10:51 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-03-25 12:42:05 +0100 |
commit | 1339c42c4aea269e5265277647361ae91882d8a5 (patch) | |
tree | a7030bb15d3f830ac8be41737fc03e0d12707019 | |
parent | 77224aaec6ba89194a404805d7190f88e92fcc9f (diff) |
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 <stephan.bergmann@allotropia.de>
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
-rw-r--r-- | sal/osl/all/log.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
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; |