Update ooo320-m1
[ooovba.git] / applied_patches / 0038-fix-linkoo.diff
blob88d5e2790f305e694786553763fcc16513b5b8a6
1 --- sal/osl/unx/file_url.cxx 2007-11-27 21:34:37.000000000 +0100
2 +++ sal/osl/unx/file_url.cxx 2007-11-27 22:15:11.000000000 +0100
3 @@ -781,6 +781,7 @@ oslFileError osl_getAbsoluteFileURL(rtl_
5 FileBase::RC rc;
6 rtl::OUString unresolved_path;
7 + static char *allow_symlinks = getenv( "SAL_ALLOW_LINKOO_SYMLINKS" );
9 rc = FileBase::getSystemPathFromFileURL(rtl::OUString(ustrRelativeURL), unresolved_path);
11 @@ -801,8 +802,33 @@ oslFileError osl_getAbsoluteFileURL(rtl_
12 unresolved_path = abs_path;
15 - rtl::OUString resolved_path;
16 - rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
17 + rtl::OUString resolved_path;
19 + if (!allow_symlinks)
20 + {
21 + rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
22 + }
23 + else
24 + {
25 + // SAL_ALLOW_LINKOO_SYMLINKS environment variable:
26 + // for linkoo to work, we need to let the symlinks to the libraries untouched
27 + rtl::OUString base;
28 + sal_Int32 last_slash = unresolved_path.lastIndexOf( UNICHAR_SLASH );
30 + if (last_slash >= 0 && last_slash + 1 < unresolved_path.getLength())
31 + {
32 + base = unresolved_path.copy(last_slash+1);
33 + unresolved_path = unresolved_path.copy(0, last_slash);
34 + }
36 + rc = (FileBase::RC) osl_getAbsoluteFileURL_impl_(unresolved_path, resolved_path);
38 + if (base.getLength() > 0)
39 + {
40 + resolved_path += rtl::OUString( UNICHAR_SLASH );
41 + resolved_path += base;
42 + }
43 + }
45 if (FileBase::E_None == rc)
47 --- solenv/bin/linkoo 2007-11-27 22:18:49.000000000 +0100
48 +++ solenv/bin/linkoo 2007-11-27 22:19:44.000000000 +0100
49 @@ -56,6 +56,7 @@ export STAR_RESOURCEPATH=`pwd`/resource
50 export OOO_FORCE_SYSALLOC=1
51 export MALLOC_CHECK_=2
52 export OOO_DISABLE_RECOVERY=1
53 +export SAL_ALLOW_LINKOO_SYMLINKS=1
56 $program_dir = 'program';