[Libreoffice-commits] .: xmlhelp/source

Fridrich Strba fridrich at kemper.freedesktop.org
Fri Nov 26 06:10:30 PST 2010


 xmlhelp/source/cxxhelp/provider/databases.cxx |   19 +++++++++++++------
 xmlhelp/source/treeview/tvread.cxx            |   12 +++++++++---
 2 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 0ddcd213811c412f9b5cd5f96a94ba0dfa1a615f
Author: Petr Mladek <pmladek at suse.cz>
Date:   Fri Nov 26 15:09:17 2010 +0100

    xmlhelp-work-with-symlinks.diff: migrated to git
    
    i#81138
    display help correctly even when the files are symlinks

diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index e05fa20..c1d57c7 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 7fe54b7..502e8bd 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();


More information about the Libreoffice-commits mailing list