20#include <config_folders.h>
26#include <com/sun/star/uno/DeploymentException.hpp>
27#include <osl/file.hxx>
28#include <osl/module.hxx>
29#include <rtl/ustring.hxx>
37#if !(defined ANDROID || defined EMSCRIPTEN)
38OUString get_this_libpath() {
39 static OUString s_uri = []() {
41 osl::Module::getUrlFromAddress(
reinterpret_cast<oslGenericFunction
>(get_this_libpath), uri);
42 sal_Int32
i = uri.lastIndexOf(
'/');
45 throw css::uno::DeploymentException(
"URI " + uri +
" is expected to contain a slash");
47 return uri.copy(0, i);
64 OUString uri(
"file:///assets/program");
65#elif defined(EMSCRIPTEN)
66 OUString uri(
"file:///instdir/program");
68 OUString uri(get_this_libpath());
72 if (uri.endsWith(
"/" LIBO_LIB_FOLDER ) )
74 uri = OUString::Concat(uri.subView( 0, uri.getLength() - (
sizeof(LIBO_LIB_FOLDER)-1) )) + LIBO_URE_ETC_FOLDER;
82 assert(url !=
nullptr);
86 case osl::FileBase::E_None:
88 case osl::FileBase::E_NOENT:
91 throw css::uno::DeploymentException(
92 "Cannot iterate directory");
95 osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName |
96 osl_FileStatus_Mask_FileURL);
97 if (
i.getFileStatus(stat) != osl::FileBase::E_None) {
98 throw css::uno::DeploymentException(
99 "Cannot stat in directory");
101 if (stat.getFileType() != osl::FileStatus::Directory) {
103 OUString
name(stat.getFileName());
104 if (
name.startsWith(
".") || !
name.endsWithIgnoreAsciiCase(
u".rdb")) {
105 SAL_WARN(
"cppuhelper",
"ignoring <" << stat.getFileURL() <<
">");
107 *url = stat.getFileURL();
116 assert(uri !=
nullptr && optional !=
nullptr && directory !=
nullptr);
119 *optional = (*uri)[0] ==
'?';
121 *uri = uri->substr(1);
125 *uri = uri->substr(1, uri->size() - 3);
#define SAL_CONFIGFILE(name)
#define SAL_WARN(area, stream)
void decodeRdbUri(std::u16string_view *uri, bool *optional, bool *directory)
bool nextDirectoryItem(osl::Directory &directory, OUString *url)
constexpr bool ends_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept