[PATCH] fdo#39445 writing out tools/fsys.hxx (idl)

Krisztian Pinter (via Code Review) gerrit at gerrit.libreoffice.org
Sat Mar 23 08:49:49 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2935

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/35/2935/1

fdo#39445 writing out tools/fsys.hxx (idl)

Removed uses of fsys from database.cxx, command.cxx, module.cxx, svidl.cxx.
Also removed a lot of cruft from svidl.cxx and command.hxx; unused variables
and code relating to them, eg. variables aCxxFile, aHxxFile, aSrcFile, aODLFile.
Changed some Strings to OUStrings in svidl.cxx and command.hxx.

Someone please test this patch under Windows.

Change-Id: I708284f70435c8f65cdcfc954af43976e28b8c9d
---
M idl/inc/command.hxx
M idl/source/objects/module.cxx
M idl/source/prj/command.cxx
M idl/source/prj/database.cxx
M idl/source/prj/svidl.cxx
5 files changed, 138 insertions(+), 159 deletions(-)



diff --git a/idl/inc/command.hxx b/idl/inc/command.hxx
index 5ca38db..b77ab2f 100644
--- a/idl/inc/command.hxx
+++ b/idl/inc/command.hxx
@@ -30,25 +30,18 @@
 class SvCommand
 {
 public:
-    String      aDataBaseFile;
+    OUString    aDataBaseFile;
     StringList  aInFileList;
-    String      aListFile;
-    String      aSlotMapFile;
-    String      aSfxItemFile;
-    String      aODLFile;
-    String      aCallingFile;
-    String      aCxxFile;
-    String      aHxxFile;
-    String      aSrcFile;
+    OUString    aListFile;
+    OUString    aSlotMapFile;
+    OUString    aSfxItemFile;
     String      aPath;
-    String      aCHeaderFile;
-    String      aCSourceFile;
     String      aTargetFile;
-    String      aHelpIdFile;
-    String      aCSVFile;
-    String      aExportFile;
-    String      aDocuFile;
-    ::rtl::OUString m_DepFile;
+    OUString    aHelpIdFile;
+    OUString    aCSVFile;
+    OUString    aExportFile;
+    OUString    aDocuFile;
+    OUString    m_DepFile;
     sal_uInt32      nVerbosity;
     sal_uInt32      nFlags;
 
diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx
index 4b97510..e83c23b 100644
--- a/idl/source/objects/module.cxx
+++ b/idl/source/objects/module.cxx
@@ -24,8 +24,8 @@
 #include <module.hxx>
 #include <globals.hxx>
 #include <database.hxx>
-#include <tools/fsys.hxx>
 #include <tools/debug.hxx>
+#include <osl/file.hxx>
 
 SV_IMPL_META_FACTORY1( SvMetaModule, SvMetaExtern );
 
@@ -222,12 +222,16 @@
         SvToken * pTok = rInStm.GetToken_Next();
         if( pTok->IsString() )
         {
-            DirEntry aFullName( rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US) );
-            rBase.StartNewFile( aFullName.GetFull() );
-            if( aFullName.Find( rBase.GetPath() ) )
+            OUString aFullName(rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US));
+            rBase.StartNewFile( aFullName );
+            osl::FileBase::RC searchError = osl::File::searchFileURL(aFullName, rBase.GetPath(), aFullName);
+            osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName );
+
+            if( osl::FileBase::E_None == searchError )
             {
-                rBase.AddDepFile(aFullName.GetFull());
-                SvTokenStream aTokStm( aFullName.GetFull() );
+                rBase.AddDepFile( aFullName );
+                SvTokenStream aTokStm( aFullName );
+
                 if( SVSTREAM_OK == aTokStm.GetStream().GetError() )
                 {
                     // rescue error from old file
@@ -252,19 +256,15 @@
                 }
                 else
                 {
-                    rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
-                        "cannot open file: "));
-                    aStr.append(rtl::OUStringToOString(aFullName.GetFull(),
-                        RTL_TEXTENCODING_UTF8));
+                    rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("cannot open file: "));
+                    aStr.append(rtl::OUStringToOString(aFullName, RTL_TEXTENCODING_UTF8));
                     rBase.SetError(aStr.makeStringAndClear(), pTok);
                 }
             }
             else
             {
-                rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
-                    "cannot find file:"));
-                aStr.append(rtl::OUStringToOString(aFullName.GetFull(),
-                    RTL_TEXTENCODING_UTF8));
+                rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("cannot find file:"));
+                aStr.append(rtl::OUStringToOString(aFullName, RTL_TEXTENCODING_UTF8));
                 rBase.SetError(aStr.makeStringAndClear(), pTok);
             }
         }
diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx
index a61804f..f538bec 100644
--- a/idl/source/prj/command.cxx
+++ b/idl/source/prj/command.cxx
@@ -26,7 +26,7 @@
 #include <command.hxx>
 #include <globals.hxx>
 #include <database.hxx>
-#include <tools/fsys.hxx>
+#include "sal/config.h"
 
 char const * SyntaxStrings[] = {
 "basic-type:",
@@ -320,7 +320,7 @@
                 { // define include paths
                     String aName( aParam.Copy( 1 ) );
                     if( aPath.Len() )
-                        aPath += DirEntry::GetSearchDelimiter();
+                        aPath += OUString( SAL_PATHSEPARATOR );
                     aPath += aName;
                 }
                 else if( aParam.EqualsIgnoreCaseAscii( "rsc", 0, 3 ) )
@@ -361,7 +361,7 @@
     if( aInc.getLength() )
     {
         if( aPath.Len() )
-            aPath += DirEntry::GetSearchDelimiter();
+            aPath += OUString( SAL_PATHSEPARATOR );
         aPath += rtl::OStringToOUString(aInc, RTL_TEXTENCODING_ASCII_US);
     }
 }
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index ff6365e..7e907e7 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -21,11 +21,11 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <tools/fsys.hxx>
 #include <tools/debug.hxx>
 #include <database.hxx>
 #include <globals.hxx>
 #include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
 
 SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
     : bExport( sal_False )
@@ -205,17 +205,17 @@
 
 sal_Bool SvIdlDataBase::ReadIdFile( const String & rFileName )
 {
-    DirEntry aFullName( rFileName );
-    aFullName.Find( GetPath() );
+    OUString aFullName;
+    osl::File::searchFileURL( rFileName, GetPath(), aFullName);
+    osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName );
 
     for ( size_t i = 0, n = aIdFileList.size(); i < n; ++i )
         if ( *aIdFileList[ i ] == rFileName )
             return sal_True;
 
     aIdFileList.push_back( new String( rFileName ) );
-
-    this->AddDepFile(aFullName.GetFull());
-    SvTokenStream aTokStm( aFullName.GetFull() );
+    this->AddDepFile( aFullName );
+    SvTokenStream aTokStm( aFullName );
     if( aTokStm.GetStream().GetError() == SVSTREAM_OK )
     {
         SvToken * pTok = aTokStm.GetToken_Next();
@@ -634,20 +634,22 @@
             pTok = rInStm.GetToken_Next();
             if( pTok->IsString() )
             {
-                DirEntry aFullName(rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US));
-                if( aFullName.Find( rPath ) )
+                OUString aFullName;
+                if( osl::FileBase::E_None == osl::File::searchFileURL(
+                    rtl::OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US),
+                    rPath,
+                    aFullName) )
                 {
-                    this->AddDepFile(aFullName.GetFull());
-                    SvFileStream aStm( aFullName.GetFull(),
-                                        STREAM_STD_READ | STREAM_NOCREATE );
+                    osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName );
+                    this->AddDepFile(aFullName);
+                    SvFileStream aStm( aFullName, STREAM_STD_READ | STREAM_NOCREATE );
                     Load( aStm );
                     if( aStm.GetError() != SVSTREAM_OK )
                     {
                         if( aStm.GetError() == SVSTREAM_WRONGVERSION )
                         {
                             rtl::OStringBuffer aStr("wrong version, file ");
-                            aStr.append(rtl::OUStringToOString(
-                                aFullName.GetFull(), RTL_TEXTENCODING_UTF8));
+                            aStr.append(rtl::OUStringToOString( aFullName, RTL_TEXTENCODING_UTF8));
                             SetError(aStr.makeStringAndClear(), pTok);
                             WriteError( rInStm );
                             bOk = sal_False;
@@ -656,7 +658,7 @@
                         {
                             aStm.Seek( 0 );
                             aStm.ResetError();
-                            SvTokenStream aTokStm( aStm, aFullName.GetFull() );
+                            SvTokenStream aTokStm( aStm, aFullName );
                             bOk = ReadSvIdl( aTokStm, sal_True, rPath );
                         }
                     }
diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx
index 3dbb176..34f838d 100644
--- a/idl/source/prj/svidl.cxx
+++ b/idl/source/prj/svidl.cxx
@@ -23,8 +23,8 @@
 #include <database.hxx>
 #include <globals.hxx>
 #include <command.hxx>
-#include <tools/fsys.hxx>
 #include <tools/string.hxx>
+#include <osl/file.hxx>
 
 #define BR 0x8000
 sal_Bool FileMove_Impl( const String & rFile1, const String & rFile2, sal_Bool bImmerVerschieben )
@@ -61,22 +61,47 @@
             delete[] pBuf2;
         }
     }
-    DirEntry aF2( rFile2 );
+    OUString fileURL2;
+    osl::FileBase::getFileURLFromSystemPath( rFile2, fileURL2 );
     if( nC1 != nC2 )
     {// something has changed
-        DirEntry aF1( rFile1 );
-        aF1.Kill();
+        OUString fileURL1;
+        osl::FileBase::getFileURLFromSystemPath( rFile1, fileURL1 );
         // move file
-        if( aF2.MoveTo( aF1 ) )
+        if( osl::FileBase::E_None != osl::File::move( fileURL2, fileURL1 ) )
         {
             // delete both files
-            aF1.Kill();
-            aF2.Kill();
+            osl::File::remove( fileURL1 );
+            osl::File::remove( fileURL2 );
             return sal_False;
         }
         return sal_True;
     }
-    return 0 == aF2.Kill();
+    return osl::FileBase::E_None == osl::File::remove( fileURL2 );
+}
+
+//This function gets a system path to a file [fname], creates a temp file in
+//the same folder as [fname] and returns the system path of the temp file.
+inline OUString tempFileHelper(OUString const & fname)
+{
+    OUString aTmpFile;
+    oslFileHandle fhdl;
+
+    sal_Int32 delimIndex = fname.lastIndexOf( SAL_PATHDELIMITER );
+    if( delimIndex > 0 )
+    {
+        OUString aTmpDir( fname.copy( 0,  delimIndex ) );
+        osl::FileBase::getFileURLFromSystemPath( aTmpDir, aTmpDir );
+        osl::DirectoryItem::createTempFile( &aTmpDir, &fhdl, &aTmpFile );
+        osl::FileBase::getSystemPathFromFileURL( aTmpFile, aTmpFile );
+    }
+    else
+    {
+        rtl::OStringBuffer aStr("invalid filename: ");
+        aStr.append(rtl::OUStringToOString(fname, RTL_TEXTENCODING_UTF8));
+        fprintf(stderr, "%s\n", aStr.getStr());
+    }
+    return aTmpFile;
 }
 
 #if defined( UNX ) || defined (__MINGW32__)
@@ -87,17 +112,14 @@
 {
 #endif
 
-    String aTmpListFile;
-    String aTmpSlotMapFile;
-    String aTmpSfxItemFile;
-    String aTmpDataBaseFile;
-    String aTmpCallingFile;
-    String aTmpCxxFile;
-    String aTmpHxxFile;
-    String aTmpHelpIdFile;
-    String aTmpCSVFile;
-    String aTmpDocuFile;
-    String aTmpDepFile;
+    OUString aTmpListFile;
+    OUString aTmpSlotMapFile;
+    OUString aTmpSfxItemFile;
+    OUString aTmpDataBaseFile;
+    OUString aTmpHelpIdFile;
+    OUString aTmpCSVFile;
+    OUString aTmpDocuFile;
+    OUString aTmpDepFile;
 
     SvCommand aCommand( argc, argv );
 
@@ -108,125 +130,105 @@
     SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase(aCommand);
 
     int nExit = 0;
-    if( aCommand.aExportFile.Len() )
+    if( !aCommand.aExportFile.isEmpty() )
     {
-        DirEntry aDE( aCommand.aExportFile );
-        pDataBase->SetExportFile( aDE.GetName() );
+        osl::DirectoryItem aDI;
+        osl::FileStatus fileStatus( osl_FileStatus_Mask_FileName );
+        osl::DirectoryItem::get( aCommand.aExportFile, aDI );
+        aDI.getFileStatus(fileStatus);
+        pDataBase->SetExportFile( fileStatus.getFileName() );
     }
 
     if( ReadIdl( pDataBase, aCommand ) )
     {
-        if( nExit == 0 && aCommand.aDocuFile.Len() )
+        if( nExit == 0 && !aCommand.aDocuFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aDocuFile );
-            aDE.ToAbs();
-            aTmpDocuFile = aDE.GetPath().TempName().GetFull();
+            aTmpDocuFile = tempFileHelper(aCommand.aDocuFile);
             SvFileStream aOutStm( aTmpDocuFile, STREAM_READWRITE | STREAM_TRUNC );
             if( !pDataBase->WriteDocumentation( aOutStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write documentation file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aDocuFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aDocuFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aListFile.Len() )
+        if( nExit == 0 && !aCommand.aListFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aListFile );
-            aDE.ToAbs();
-            aTmpListFile = aDE.GetPath().TempName().GetFull();
+            aTmpListFile = tempFileHelper(aCommand.aListFile);
             SvFileStream aOutStm( aTmpListFile, STREAM_READWRITE | STREAM_TRUNC );
             if( !pDataBase->WriteSvIdl( aOutStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write list file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aListFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aListFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aSlotMapFile.Len() )
+        if( nExit == 0 && !aCommand.aSlotMapFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aSlotMapFile );
-            aDE.ToAbs();
-            aTmpSlotMapFile = aDE.GetPath().TempName().GetFull();
+            aTmpSlotMapFile = tempFileHelper(aCommand.aSlotMapFile);
             SvFileStream aOutStm( aTmpSlotMapFile, STREAM_READWRITE | STREAM_TRUNC );
             if( !pDataBase->WriteSfx( aOutStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write slotmap file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aSlotMapFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aSlotMapFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aHelpIdFile.Len() )
+        if( nExit == 0 && !aCommand.aHelpIdFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aHelpIdFile );
-            aDE.ToAbs();
-            aTmpHelpIdFile = aDE.GetPath().TempName().GetFull();
+            aTmpHelpIdFile = tempFileHelper(aCommand.aHelpIdFile);
             SvFileStream aStm( aTmpHelpIdFile, STREAM_READWRITE | STREAM_TRUNC );
             if (!pDataBase->WriteHelpIds( aStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write help ID file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aHelpIdFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aHelpIdFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aCSVFile.Len() )
+        if( nExit == 0 && !aCommand.aCSVFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aCSVFile );
-            aDE.ToAbs();
-            aTmpCSVFile = aDE.GetPath().TempName().GetFull();
+            aTmpCSVFile = tempFileHelper(aCommand.aCSVFile);
             SvFileStream aStm( aTmpCSVFile, STREAM_READWRITE | STREAM_TRUNC );
             if (!pDataBase->WriteCSV( aStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write CSV file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aCSVFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aCSVFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aSfxItemFile.Len() )
+        if( nExit == 0 && !aCommand.aSfxItemFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aSfxItemFile );
-            aDE.ToAbs();
-            aTmpSfxItemFile = aDE.GetPath().TempName().GetFull();
+            aTmpSfxItemFile = tempFileHelper(aCommand.aSfxItemFile);
             SvFileStream aOutStm( aTmpSfxItemFile, STREAM_READWRITE | STREAM_TRUNC );
             if( !pDataBase->WriteSfxItem( aOutStm ) )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write item file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aSfxItemFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aSfxItemFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
-        if( nExit == 0 && aCommand.aDataBaseFile.Len() )
+        if( nExit == 0 && !aCommand.aDataBaseFile.isEmpty() )
         {
-            DirEntry aDE( aCommand.aDataBaseFile );
-            aDE.ToAbs();
-            aTmpDataBaseFile = aDE.GetPath().TempName().GetFull();
+            aTmpDataBaseFile = tempFileHelper(aCommand.aDataBaseFile);
             SvFileStream aOutStm( aTmpDataBaseFile, STREAM_READWRITE | STREAM_TRUNC );
             pDataBase->Save( aOutStm, aCommand.nFlags );
             if( aOutStm.GetError() != SVSTREAM_OK )
             {
                 nExit = -1;
                 rtl::OStringBuffer aStr("cannot write database file: ");
-                aStr.append(rtl::OUStringToOString(aCommand.aDataBaseFile,
-                    RTL_TEXTENCODING_UTF8));
+                aStr.append(rtl::OUStringToOString(aCommand.aDataBaseFile, RTL_TEXTENCODING_UTF8));
                 fprintf(stderr, "%s\n", aStr.getStr());
             }
         }
         if (nExit == 0 && !aCommand.m_DepFile.isEmpty())
         {
-            DirEntry aDE(aCommand.m_DepFile);
-            aDE.ToAbs();
-            aTmpDepFile = aDE.GetPath().TempName().GetFull();
+            aTmpDepFile = tempFileHelper(aCommand.m_DepFile);
             SvFileStream aOutStm( aTmpDepFile, STREAM_READWRITE | STREAM_TRUNC );
             pDataBase->WriteDepFile(aOutStm, aCommand.aTargetFile);
             if( aOutStm.GetError() != SVSTREAM_OK )
@@ -246,7 +248,7 @@
         sal_Bool bErr = sal_False;
         sal_Bool bDoMove = aCommand.aTargetFile.Len() == 0;
         String aErrFile, aErrFile2;
-        if( !bErr && aCommand.aListFile.Len() )
+        if( !bErr && !aCommand.aListFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aListFile, aTmpListFile, bDoMove );
             if( bErr ) {
@@ -254,7 +256,7 @@
                 aErrFile2 = aTmpListFile;
             }
         }
-        if( !bErr && aCommand.aSlotMapFile.Len() )
+        if( !bErr && !aCommand.aSlotMapFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aSlotMapFile, aTmpSlotMapFile, bDoMove );
             if( bErr ) {
@@ -262,7 +264,7 @@
                 aErrFile2 = aTmpSlotMapFile;
             }
         }
-        if( !bErr && aCommand.aSfxItemFile.Len() )
+        if( !bErr && !aCommand.aSfxItemFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aSfxItemFile, aTmpSfxItemFile, bDoMove );
             if( bErr ) {
@@ -270,7 +272,7 @@
                 aErrFile2 = aTmpSfxItemFile;
             }
         }
-        if( !bErr && aCommand.aDataBaseFile.Len() )
+        if( !bErr && !aCommand.aDataBaseFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aDataBaseFile, aTmpDataBaseFile, bDoMove );
             if( bErr ) {
@@ -278,31 +280,7 @@
                 aErrFile2 = aTmpDataBaseFile;
             }
         }
-        if( !bErr && aCommand.aCallingFile.Len() )
-        {
-            bErr |= !FileMove_Impl( aCommand.aCallingFile, aTmpCallingFile, bDoMove );
-            if( bErr ) {
-                aErrFile = aCommand.aCallingFile;
-                aErrFile2 = aTmpCallingFile;
-            }
-        }
-        if( !bErr && aCommand.aCxxFile.Len() )
-        {
-            bErr |= !FileMove_Impl( aCommand.aCxxFile, aTmpCxxFile, bDoMove );
-            if( bErr ) {
-                aErrFile = aCommand.aCxxFile;
-                aErrFile2 = aTmpCxxFile;
-            }
-        }
-        if( !bErr && aCommand.aHxxFile.Len() )
-        {
-            bErr |= !FileMove_Impl( aCommand.aHxxFile, aTmpHxxFile, bDoMove );
-            if( bErr ) {
-                aErrFile = aCommand.aHxxFile;
-                aErrFile2 = aTmpHxxFile;
-            }
-        }
-        if( !bErr && aCommand.aHelpIdFile.Len() )
+        if( !bErr && !aCommand.aHelpIdFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aHelpIdFile, aTmpHelpIdFile, bDoMove );
             if( bErr ) {
@@ -310,7 +288,7 @@
                 aErrFile2 = aTmpHelpIdFile;
             }
         }
-        if( !bErr && aCommand.aCSVFile.Len() )
+        if( !bErr && !aCommand.aCSVFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aCSVFile, aTmpCSVFile, bDoMove );
             if( bErr ) {
@@ -318,7 +296,7 @@
                 aErrFile2 = aTmpCSVFile;
             }
         }
-        if( !bErr && aCommand.aDocuFile.Len() )
+        if( !bErr && !aCommand.aDocuFile.isEmpty() )
         {
             bErr |= !FileMove_Impl( aCommand.aDocuFile, aTmpDocuFile, bDoMove );
             if( bErr ) {
@@ -363,20 +341,26 @@
 
     if( nExit != 0 )
     {
-        if( aCommand.aListFile.Len() )
-            DirEntry( aTmpListFile ).Kill();
-        if( aCommand.aSlotMapFile.Len() )
-            DirEntry( aTmpSlotMapFile ).Kill();
-        if( aCommand.aSfxItemFile.Len() )
-            DirEntry( aTmpSfxItemFile ).Kill();
-        if( aCommand.aDataBaseFile.Len() )
-            DirEntry( aTmpDataBaseFile ).Kill();
-        if( aCommand.aCallingFile.Len() )
-            DirEntry( aTmpCallingFile ).Kill();
-        if( aCommand.aCxxFile.Len() )
-            DirEntry( aTmpCxxFile ).Kill();
-        if( aCommand.aHxxFile.Len() )
-            DirEntry( aTmpHxxFile ).Kill();
+        if( !aCommand.aListFile.isEmpty() )
+        {
+            osl::FileBase::getSystemPathFromFileURL( aTmpListFile, aTmpListFile );
+            osl::File::remove( aTmpListFile );
+        }
+        if( !aCommand.aSlotMapFile.isEmpty() )
+        {
+            osl::FileBase::getSystemPathFromFileURL( aTmpSlotMapFile, aTmpSlotMapFile );
+            osl::File::remove( aTmpSlotMapFile );
+        }
+        if( !aCommand.aSfxItemFile.isEmpty() )
+        {
+            osl::FileBase::getSystemPathFromFileURL( aTmpSfxItemFile, aTmpSfxItemFile );
+            osl::File::remove( aTmpSfxItemFile );
+        }
+        if( !aCommand.aDataBaseFile.isEmpty() )
+        {
+            osl::FileBase::getSystemPathFromFileURL( aTmpDataBaseFile, aTmpDataBaseFile );
+            osl::File::remove( aTmpDataBaseFile );
+        }
     }
 
     delete pDataBase;

-- 
To view, visit https://gerrit.libreoffice.org/2935
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I708284f70435c8f65cdcfc954af43976e28b8c9d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Krisztian Pinter <pin.terminator at gmail.com>



More information about the LibreOffice mailing list