diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-06-09 11:48:27 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-06-09 11:48:27 +0000 |
commit | 9c86137d70177d0744569d9948bd4944267a61a6 (patch) | |
tree | 32ed3510b6db3980269ef6346daae6468bc1d463 | |
parent | fa0e308736659b9d30df45c438c78b72e6d4ebdf (diff) |
INTEGRATION: CWS sb87 (1.40.10); FILE MERGED
2008/05/09 14:52:07 sb 1.40.10.6: #i88211# introduced vnd.sun.star.pathname pseudo URL feature for INIFILENAME and URE_BOOTSTRAP, dropped INIFILEPATH feature again in return
2008/05/07 15:28:07 sb 1.40.10.5: #i78000# check error return values
2008/04/24 13:19:05 sb 1.40.10.4: RESYNC: (1.40-1.41); FILE MERGED
2008/04/21 09:40:11 sb 1.40.10.3: #i88211# added rtl_bootstrap_encode
2008/04/11 13:22:12 sb 1.40.10.2: #i87730# reverted previous change, ${.verb:...} not needed after all
2008/04/09 13:46:08 sb 1.40.10.1: #i87730# added ${.verb:...}
-rw-r--r-- | sal/rtl/source/bootstrap.cxx | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx index 83c2e1a82..cf508342b 100644 --- a/sal/rtl/source/bootstrap.cxx +++ b/sal/rtl/source/bootstrap.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: bootstrap.cxx,v $ - * $Revision: 1.41 $ + * $Revision: 1.42 $ * * This file is part of OpenOffice.org. * @@ -67,6 +67,21 @@ struct Bootstrap_Impl; namespace { +bool resolvePathnameUrl(rtl::OUString * url) { + OSL_ASSERT(url != NULL); + static char const schema[] = "vnd.sun.star.pathname:"; + if (!url->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(schema)) || + (osl::FileBase::getFileURLFromSystemPath( + url->copy(RTL_CONSTASCII_LENGTH(schema)), *url) == + osl::FileBase::E_None)) + { + return true; + } else { + *url = rtl::OUString(); + return false; + } +} + static char const URE_BOOTSTRAP[] = "URE_BOOTSTRAP"; struct FundamentalIniData { @@ -75,8 +90,9 @@ struct FundamentalIniData { FundamentalIniData() { OUString uri; ini = - rtl::Bootstrap::get( - OUString(RTL_CONSTASCII_USTRINGPARAM(URE_BOOTSTRAP)), uri) + (rtl::Bootstrap::get( + OUString(RTL_CONSTASCII_USTRINGPARAM(URE_BOOTSTRAP)), uri) && + resolvePathnameUrl(&uri)) ? rtl_bootstrap_args_open(uri.pData) : NULL; } @@ -227,22 +243,7 @@ static OUString & getIniFileName_Impl() &fileName.pData, OUString(RTL_CONSTASCII_USTRINGPARAM("INIFILENAME")).pData)) { - // do nothing - } - else if(getFromCommandLineArgs( - &fileName.pData, - OUString(RTL_CONSTASCII_USTRINGPARAM("INIFILEPATH")).pData)) - { - OUString url; - if (osl::FileBase::getFileURLFromSystemPath(fileName, url) == - osl::FileBase::E_None) - { - fileName = url; - } - else - { - fileName = OUString(); - } + resolvePathnameUrl(&fileName); } else { @@ -493,16 +494,20 @@ sal_Bool Bootstrap_Impl::getValue( if (name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SYSUSERCONFIG") )) { oslSecurity security = osl_getCurrentSecurity(); - osl_getConfigDir(security, ppValue); - EnsureNoFinalSlash(ppValue); + result = osl_getConfigDir(security, ppValue); + if (result) { + EnsureNoFinalSlash(ppValue); + } osl_freeSecurityHandle(security); further_macro_expansion = false; } else if (name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SYSUSERHOME") )) { oslSecurity security = osl_getCurrentSecurity(); - osl_getHomeDir(security, ppValue); - EnsureNoFinalSlash(ppValue); + result = osl_getHomeDir(security, ppValue); + if (result) { + EnsureNoFinalSlash(ppValue); + } osl_freeSecurityHandle(security); further_macro_expansion = false; } @@ -865,7 +870,20 @@ void SAL_CALL rtl_bootstrap_expandMacros( rtl_bootstrap_expandMacros_from_handle(NULL, macro); } -//---------------------------------------------------------------------------- +void rtl_bootstrap_encode( rtl_uString const * value, rtl_uString ** encoded ) + SAL_THROW_EXTERN_C() +{ + OSL_ASSERT(value != NULL); + rtl::OUStringBuffer b; + for (sal_Int32 i = 0; i < value->length; ++i) { + sal_Unicode c = value->buffer[i]; + if (c == '$' || c == '\\') { + b.append(sal_Unicode('\\')); + } + b.append(c); + } + rtl_uString_assign(encoded, b.makeStringAndClear().pData); +} namespace { |