From 6c3199bfcb468b6158c1692ec88e961129962352 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Fri, 26 Nov 2010 15:09:17 +0100 Subject: xmlhelp-work-with-symlinks.diff: migrated to git i#81138 display help correctly even when the files are symlinks --- xmlhelp/source/cxxhelp/provider/databases.cxx | 19 +++++++++++++------ xmlhelp/source/treeview/tvread.cxx | 12 +++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'xmlhelp/source') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 6c0652515ee0..711021d17627 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -31,6 +31,7 @@ #include "db.hxx" #include #include +#include #include #include #include @@ -237,17 +238,21 @@ static bool impl_getZipFile( const rtl::OUString & rZipName, rtl::OUString & rFileName ) { + rtl::OUString aWorkingDir; + osl_getProcessWorkingDir( &aWorkingDir.pData ); const rtl::OUString *pPathArray = rImagesZipPaths.getArray(); for ( int i = 0; i < rImagesZipPaths.getLength(); ++i ) { - rFileName = pPathArray[ i ]; - if ( rFileName.getLength() ) + rtl::OUString aFileName = pPathArray[ i ]; + if ( aFileName.getLength() ) { - if ( 1 + rFileName.lastIndexOf( '/' ) != rFileName.getLength() ) + if ( 1 + aFileName.lastIndexOf( '/' ) != aFileName.getLength() ) { - rFileName += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/" )); + aFileName += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/" )); } - rFileName += rZipName; + aFileName += rZipName; + // the icons are not read when the URL is a symlink + osl::File::getAbsoluteFileURL( aWorkingDir, aFileName, rFileName ); // test existence osl::DirectoryItem aDirItem; @@ -1327,7 +1332,9 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, osl::FileBase::E_None == aFile.open( OpenFlag_Read ) && osl::FileBase::E_None == aDirItem.getFileStatus( aStatus ) ) { - m_nCustomCSSDocLength = int( aStatus.getFileSize() ); + sal_uInt64 nSize; + aFile.getSize( nSize ); + m_nCustomCSSDocLength = (int)nSize; m_pCustomCSSDoc = new char[ 1 + m_nCustomCSSDocLength ]; m_pCustomCSSDoc[ m_nCustomCSSDocLength ] = 0; sal_uInt64 a = m_nCustomCSSDocLength,b = m_nCustomCSSDocLength; diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index b017ae6e6b7c..8c9851fb33bd 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -780,9 +780,15 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) rtl::OUString baseName = aFileName.copy(0,idx_).toAsciiLowerCase(); if(! showBasic && baseName.compareToAscii("sbasic") == 0 ) continue; - - configData.vFileLen.push_back( aFileStatus.getFileSize() ); - configData.vFileURL.push_back( aFileUrl ); + osl::File aFile( aFileUrl ); + if( osl::FileBase::E_None == aFile.open( OpenFlag_Read ) ) + { + sal_uInt64 nSize; + aFile.getSize( nSize ); + configData.vFileLen.push_back( aFileStatus.getFileSize() ); + configData.vFileURL.push_back( aFileUrl ); + aFile.close(); + } } } aDirectory.close(); -- cgit