Kaydet (Commit) e43fd91b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fix for making absolute the registry arguments of the uno executable

a25bec0c "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
üst 174b6db5
......@@ -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 >();
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment