--- sal/osl/unx/file_url.cxx 2007-11-27 21:34:37.000000000 +0100 +++ sal/osl/unx/file_url.cxx 2007-11-27 22:15:11.000000000 +0100 @@ -781,6 +781,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_ { FileBase::RC rc; rtl::OUString unresolved_path; + static char *allow_symlinks = getenv( "SAL_ALLOW_LINKOO_SYMLINKS" ); rc = FileBase::getSystemPathFromFileURL(rtl::OUString(ustrRelativeURL), unresolved_path); @@ -801,8 +802,33 @@ oslFileError osl_getAbsoluteFileURL(rtl_ unresolved_path = abs_path; } - rtl::OUString resolved_path; - rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path); + rtl::OUString 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) { --- solenv/bin/linkoo 2007-11-27 22:18:49.000000000 +0100 +++ solenv/bin/linkoo 2007-11-27 22:19:44.000000000 +0100 @@ -56,6 +56,7 @@ export STAR_RESOURCEPATH=`pwd`/resource export OOO_FORCE_SYSALLOC=1 export MALLOC_CHECK_=2 export OOO_DISABLE_RECOVERY=1 +export SAL_ALLOW_LINKOO_SYMLINKS=1 '; $program_dir = 'program';