[Libreoffice-commits] .: l10ntools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 20 23:33:51 PST 2012


 l10ntools/source/renewpo.cxx |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 7f0bf0941c29fd0e1a83b6f4823f5c220f9cf365
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Nov 21 08:31:50 2012 +0100

    dirent.h doesn't exist on windows
    
    Change-Id: Id2afa8a9ef944285a34f51cd685cd0ff5a9b6041

diff --git a/l10ntools/source/renewpo.cxx b/l10ntools/source/renewpo.cxx
index 87a871a..13a7016 100644
--- a/l10ntools/source/renewpo.cxx
+++ b/l10ntools/source/renewpo.cxx
@@ -9,7 +9,6 @@
 
 #include <iostream>
 #include <fstream>
-#include <dirent.h>
 #include <string>
 #include <vector>
 #include <map>
@@ -58,12 +57,10 @@ OString DelLocalId(const OString& rLine)
 }
 
 //Renew po files of the actual language
-void HandleLanguage(struct dirent* pLangEntry, const OString& rOldPath,
+void HandleLanguage(const OString& LangEntryName, const OString& rOldPath,
     const OString& rNewPath, const OString& rpo2loPath,
     const OString& rSDFPath)
 {
-    const OString LangEntryName = pLangEntry->d_name;
-
     //Generate and open sdf
     cout << "Process start with language: " <<  LangEntryName.getStr() << endl;
     OUString aTempUrl;
@@ -228,15 +225,27 @@ int main(int argc, char* argv[])
     }
 
     //Call processing function with all language directories
-    DIR* pTranslations = opendir(argv[1]);
-    while ( struct dirent* pActEntry = readdir(pTranslations) )
+    OUString pathUrl;
+    if( osl::Directory::getFileURLFromSystemPath(
+        OStringToOUString( argv[ 1 ], RTL_TEXTENCODING_UTF8 ), pathUrl ) == osl::Directory::E_None )
     {
-        if ( OString(pActEntry->d_name).indexOf('.')==-1 )
-            HandleLanguage(pActEntry,OString(argv[1]),
+        osl::Directory dir( pathUrl );
+        if( dir.reset() == osl::Directory::E_None )
+        {
+            for(;;)
+            {
+                osl::DirectoryItem item;
+                if( dir.getNextItem( item ) != osl::Directory::E_None )
+                    break;
+                osl::FileStatus status( osl_FileStatus_Mask_FileName );
+                if( item.getFileStatus( status ) == osl::File::E_None && status.getFileName().indexOf('.')==-1 )
+                    HandleLanguage( OUStringToOString(status.getFileName(), RTL_TEXTENCODING_UTF8),
+                           OString(argv[1]),
                            OString(argv[2]),OString(argv[3]),
                            OString(argv[4]));
+            }
+        }
     }
-    closedir(pTranslations);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list