diff options
author | Petr Mladek <pmladek@suse.cz> | 2010-11-26 15:09:17 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2010-11-26 15:09:17 +0100 |
commit | 6c3199bfcb468b6158c1692ec88e961129962352 (patch) | |
tree | 7dddab7dfdccf6f051da60d5ff4b2d2cbaceeac8 /xmlhelp | |
parent | 726f043f3393fa9a08dad20bd4a270c68420955f (diff) |
xmlhelp-work-with-symlinks.diff: migrated to git
i#81138
display help correctly even when the files are symlinks
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 19 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 12 |
2 files changed, 22 insertions, 9 deletions
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 <osl/diagnose.h> #include <osl/thread.h> +#include <osl/process.h> #include <rtl/uri.hxx> #include <osl/file.hxx> #include <rtl/memory.h> @@ -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(); |