summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpputools/source/unoexe/unoexe.cxx17
-rw-r--r--sal/osl/unx/file_url.cxx12
2 files changed, 16 insertions, 13 deletions
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index 54d02de0b721..f657c8983fdc 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -29,7 +29,6 @@
#include <rtl/process.h>
#include <rtl/string.h>
#include <rtl/strbuf.hxx>
-#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <uno/environment.h>
@@ -84,12 +83,13 @@ static OUString convertToFileUrl(const OUString& fileName)
if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) {
OSL_ASSERT(false);
}
- if (!uWorkingDir.isEmpty()
- && uWorkingDir[uWorkingDir.getLength() - 1] != '/')
+ OUString uUrlFileName;
+ if (FileBase::getAbsoluteFileURL(uWorkingDir, fileName, uUrlFileName)
+ != FileBase::E_None)
{
- uWorkingDir += "/";
+ OSL_ASSERT(false);
}
- return rtl::Uri::convertRelToAbs(uWorkingDir, fileName);
+ return uUrlFileName;
}
static sal_Bool s_quiet = false;
@@ -334,13 +334,6 @@ static Reference< XSimpleRegistry > openRegistry(
out( ": " );
out( e.Message );
}
- catch (rtl::MalformedUriException & e)
- {
- out( "\n> warning: cannot open registry " );
- out( rURL );
- out( ": " );
- out( e.getMessage() );
- }
return Reference< XSimpleRegistry >();
}
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 082f85cfa051..7c28b8ca4ca9 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -675,10 +675,20 @@ namespace /* private */
oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* ustrRelativeURL, rtl_uString** pustrAbsoluteURL)
{
+ // Work around the below call to getSystemPathFromFileURL rejecting input
+ // that starts with "/" (for whatever reason it behaves that way; but
+ // changing that would start to break lots of tests at least):
+ rtl::OUString relUrl(ustrRelativeURL);
+ if (relUrl.startsWith("//")) {
+ relUrl = "file:" + relUrl;
+ } else if (relUrl.startsWith("/")) {
+ relUrl = "file://" + relUrl;
+ }
+
FileBase::RC rc;
rtl::OUString unresolved_path;
- rc = FileBase::getSystemPathFromFileURL(rtl::OUString(ustrRelativeURL), unresolved_path);
+ rc = FileBase::getSystemPathFromFileURL(relUrl, unresolved_path);
if(FileBase::E_None != rc)
return oslFileError(rc);