16#include <osl/file.hxx>
17#include <osl/thread.h>
18#include <rtl/textcvt.h>
19#include <rtl/ustring.h>
20#include <rtl/ustring.hxx>
28 static auto const flatpak = [] {
return std::getenv(
"LIBO_FLATPAK") !=
nullptr; }();
38} temporaryHtmlDirectoryStatus;
43 assert(url !=
nullptr);
45 if (!temporaryHtmlDirectoryStatus.created) {
47 auto const env = std::getenv(
"XDG_CACHE_HOME");
49 SAL_WARN(
"sfx.appl",
"LIBO_FLATPAK mode but unset XDG_CACHE_HOME");
53 if (!rtl_convertStringToUString(
54 &path.pData,
env, std::strlen(
env), osl_getThreadTextEncoding(),
55 (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
56 | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
60 "LIBO_FLATPAK mode failure converting XDG_CACHE_HOME \"" <<
env <<
"\" encoding");
64 auto const err = osl::FileBase::getFileURLFromSystemPath(path, parent);
65 if (
err != osl::FileBase::E_None) {
68 "LIBO_FLATPAK mode failure converting XDG_CACHE_HOME \"" << path <<
"\" to URL: "
72 if (!parent.endsWith(
"/")) {
76 if (temporaryHtmlDirectoryStatus.url.isEmpty()) {
78 "sfx.appl",
"LIBO_FLATPAK mode failure creating temp dir at <" << parent <<
">");
81 temporaryHtmlDirectoryStatus.created =
true;
83 *url = &temporaryHtmlDirectoryStatus.url;
89 if (temporaryHtmlDirectoryStatus.created) {
93 "LIBO_FLATPAK mode failure removing directory <"
94 << temporaryHtmlDirectoryStatus.url <<
">");
#define DBG_TESTSOLARMUTEX()
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > & env
bool createTemporaryHtmlDirectory(OUString **url)
SFX2_DLLPUBLIC void removeTemporaryHtmlDirectory()
UNOTOOLS_DLLPUBLIC bool Kill(OUString const &url)
OUString CreateTempURL(const OUString *pParent, bool bDirectory)