diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-12-19 11:13:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-12-19 11:19:49 +0100 |
commit | e43fd91b5165a219a4b811209c7efad17379308f (patch) | |
tree | b6f73dc261fe704e9946a33ec2191dedf10aa6df /sal | |
parent | 174b6db5a01314c1651e0787272669950d1be823 (diff) |
Fix for making absolute the registry arguments of the uno executable
a25bec0cb20671a8a8e2eacd61138773f4275875 "Properly absolutize all registry
arguments of uno executable" at least broke testtools/CustomTarget_uno_test.mk
on Windows, where some -ro argument system path starting with a drive letter
("C:/...") is passed in, which rtl::Uri::convertRelToAbs mis-interprets as a
URI with scheme "c".
Switching to osl::FileBase::getAbsoluteFileURL started to break Linux, where
osl_getAbsoluteFileURL for whatever reason calls
osl::FileBase::getSystemPathFromFileURL, which in turn for whetever reason
rejects relative input that starts with "/". The easiest fix that appears not
to break anything else appears to be the workaround now added to
osl_getAbsoluteFileURL.
Change-Id: If03e7136ecc2c26a8f31e591257b1886f3ab129b
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_url.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
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); |