summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-08-24 13:54:50 +0200
committerJan Holesovsky <kendy@suse.cz>2010-08-24 13:54:50 +0200
commit904e5801aea86a79d6256fcbc3cfdba4535ca8a9 (patch)
tree212c930e9c4af9ae48db629e8af41b940749b163 /sal/osl
parentb823d4b0c7007c94988a5fea6fb9f7e742f7627e (diff)
fix-linkoo.diff: Fix linkoo to work again.
We cannot absolutize all the links, otherwise we have bootstrap problems - i#83548.
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/file_url.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 26290957f802..17ed6ecc8a73 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -692,6 +692,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
{
FileBase::RC rc;
rtl::OUString unresolved_path;
+ static char *allow_symlinks = getenv( "SAL_ALLOW_LINKOO_SYMLINKS" );
rc = FileBase::getSystemPathFromFileURL(rtl::OUString(ustrRelativeURL), unresolved_path);
@@ -713,7 +714,32 @@ oslFileError osl_getAbsoluteFileURL(rtl_uString* ustrBaseDirURL, rtl_uString* u
}
rtl::OUString resolved_path;
- rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
+
+ if (!allow_symlinks)
+ {
+ rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
+ }
+ else
+ {
+ // SAL_ALLOW_LINKOO_SYMLINKS environment variable:
+ // for linkoo to work, we need to let the symlinks to the libraries untouched
+ rtl::OUString base;
+ sal_Int32 last_slash = unresolved_path.lastIndexOf( UNICHAR_SLASH );
+
+ if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength())
+ {
+ base = unresolved_path.copy(last_slash+1);
+ unresolved_path = unresolved_path.copy(0, last_slash);
+ }
+
+ rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
+
+ if (base.getLength() > 0)
+ {
+ resolved_path += rtl::OUString( UNICHAR_SLASH );
+ resolved_path += base;
+ }
+ }
if (FileBase::E_None == rc)
{