diff options
author | Oliver Braun <obr@openoffice.org> | 2001-05-25 08:10:49 +0000 |
---|---|---|
committer | Oliver Braun <obr@openoffice.org> | 2001-05-25 08:10:49 +0000 |
commit | a6a427cfe64b862a5564b4d3ed1e10ca3d2b23ca (patch) | |
tree | f6caa18f7f624c2b9a01f929994faad3ae2eba36 | |
parent | 37c1d051d5ea49ef1f328c9a9db8b8ee0daa623a (diff) |
#87422# more TF_FILEURL fixes
-rw-r--r-- | ucb/source/ucp/file/filid.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/file/shell.cxx | 55 |
2 files changed, 57 insertions, 6 deletions
diff --git a/ucb/source/ucp/file/filid.cxx b/ucb/source/ucp/file/filid.cxx index ff5e46a15470..bc37c2675375 100644 --- a/ucb/source/ucp/file/filid.cxx +++ b/ucb/source/ucp/file/filid.cxx @@ -2,9 +2,9 @@ * * $RCSfile: filid.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: kso $ $Date: 2000-10-16 14:53:36 $ + * last change: $Author: obr $ $Date: 2001-05-25 09:10:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,7 +84,11 @@ FileContentIdentifier::FileContentIdentifier( m_pMyShell->uncheckMountPoint( aUnqPath,aRedirectedPath ); if( aRedirectedPath == rtl::OUString() && m_pMyShell->m_vecMountPoint.size() ) { +#ifdef TF_FILEURL + aRedirectedPath = rtl::OUString::createFromAscii( "file:///" ); +#else aRedirectedPath = rtl::OUString::createFromAscii( "//./" ); +#endif } m_pMyShell->getUrlFromUnq( aRedirectedPath,m_aContentId ); m_aNormalizedId = aUnqPath; diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 3a3d97b3778d..af6494dc5a41 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shell.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.42 $ * - * last change: $Author: hro $ $Date: 2001-05-22 09:08:30 $ + * last change: $Author: obr $ $Date: 2001-05-25 09:10:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2951,7 +2951,11 @@ sal_Bool SAL_CALL shell::getUnqFromUrl( const rtl::OUString& Url,rtl::OUString& 0 == Url.compareToAscii( "file://localhost/" ) || 0 == Url.compareToAscii( "file://127.0.0.1/" ) ) { +#ifdef TF_FILEURL + Unq = rtl::OUString::createFromAscii( "file:///" ); +#else Unq = rtl::OUString::createFromAscii( "//./" ); +#endif return false; } @@ -3607,6 +3611,48 @@ oslFileError getResolvedURL(rtl_uString* ustrPath, rtl_uString** pustrResolvedUR // makeAbsolute Path //---------------------------------------------------------------------------- +#ifdef TF_FILEURL + +static sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, rtl::OUString& aAbsPath ) +{ + sal_Int32 nIndex = 7; + + std::vector< rtl::OUString > aTokenStack; + + // should no longer happen + OSL_ASSERT( 0 != aRelPath.compareTo( rtl::OUString::createFromAscii( "//./" ), 4 ) ); + + if ( 0 != aRelPath.compareTo( rtl::OUString::createFromAscii( "file://" ), 7 ) ) + return sal_False; + + aRelPath.getToken( 0, '/', nIndex ); + + while ( nIndex >= 0 ) + { + rtl::OUString aToken = aRelPath.getToken( 0, '/', nIndex ); + + if ( aToken.compareToAscii( ".." ) == 0 ) + aTokenStack.pop_back(); + else + aTokenStack.push_back( aToken ); + } + + + std::vector< rtl::OUString >::iterator it; + aAbsPath = rtl::OUString::createFromAscii("file://"); + + for ( it = aTokenStack.begin(); it != aTokenStack.end(); it++ ) + { + aAbsPath += rtl::OUString::createFromAscii( "/" ); + aAbsPath += *it; + } + + return sal_True; +} + +#else + + static sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, rtl::OUString& aAbsPath ) { sal_Int32 nIndex = 0; @@ -3616,13 +3662,13 @@ static sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, rtl::O if ( 0 != aRelPath.compareTo( rtl::OUString::createFromAscii( "//./" ), 4 ) ) return sal_False; - aRelPath.getToken( 0, '/', nIndex ); + aRelPath.getToken( 0, '/', nIndex ); while ( nIndex >= 0 ) { rtl::OUString aToken = aRelPath.getToken( 0, '/', nIndex ); - if ( aToken.compareTo( rtl::OUString::createFromAscii( ".." ) ) == 0 ) + if ( aToken.compareToAscii( ".." ) == 0 ) aTokenStack.pop_back(); else aTokenStack.push_back( aToken ); @@ -3641,6 +3687,7 @@ static sal_Bool SAL_CALL makeAbsolutePath( const rtl::OUString& aRelPath, rtl::O return sal_True; } +#endif //---------------------------------------------------------------------------- sal_Bool SAL_CALL shell::checkMountPoint( const rtl::OUString& aUnqPath, |