Kaydet (Commit) 344773c6 authored tarafından Christian Lohmaier's avatar Christian Lohmaier

localize: sort directories to have predictable sorting in pot files

also remove pre-onegit special handling

Change-Id: Ie60be508a188e00b9eea1b743ea10f1f985c459e
Reviewed-on: https://gerrit.libreoffice.org/63288
Tested-by: Jenkins
Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst f5011d72
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <map>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
...@@ -319,10 +320,9 @@ bool includeProject(const OString& rProject) { ...@@ -319,10 +320,9 @@ bool includeProject(const OString& rProject) {
/// ///
/// @param rUrl the absolute file URL of this directory /// @param rUrl the absolute file URL of this directory
/// ///
/// @param nLevel 0 if this is either the root directory that contains the /// @param nLevel 0 if this is the root directory (core repository)
/// projects or one of the clone/* or src/* directories that contain the /// that contains the individual modules. 1 if it is a toplevel module and
/// additional projects; -1 if this is the clone directory; 1 if this /// larger values for the subdirectories.
/// is a project directory; 2 if this is a directory inside a project
/// ///
/// @param rProject the name of the project (empty and ignored if nLevel <= 0) /// @param rProject the name of the project (empty and ignored if nLevel <= 0)
/// @param rPotDir the path of pot directory /// @param rPotDir the path of pot directory
...@@ -337,6 +337,7 @@ void handleDirectory( ...@@ -337,6 +337,7 @@ void handleDirectory(
throw false; //TODO throw false; //TODO
} }
std::vector<OUString> aFileNames; std::vector<OUString> aFileNames;
std::map<OUString, std::map<OString, OString>> aSubDirs;
for (;;) { for (;;) {
osl::DirectoryItem item; osl::DirectoryItem item;
osl::FileBase::RC e = dir.getNextItem(item); osl::FileBase::RC e = dir.getNextItem(item);
...@@ -356,36 +357,18 @@ void handleDirectory( ...@@ -356,36 +357,18 @@ void handleDirectory(
} }
const OString sDirName = const OString sDirName =
OUStringToOString(stat.getFileName(),RTL_TEXTENCODING_UTF8); OUStringToOString(stat.getFileName(),RTL_TEXTENCODING_UTF8);
switch (nLevel) { switch (nLevel)
case -1: // the clone or src directory {
if (stat.getFileType() == osl::FileStatus::Directory) { case 0: // a root directory
handleDirectory( if (stat.getFileType() == osl::FileStatus::Directory && includeProject(sDirName))
stat.getFileURL(), 0, OString(), rPotDir); aSubDirs[stat.getFileURL()][sDirName] = rPotDir.concat("/").concat(sDirName);
} break;
break; default:
case 0: // a root directory if (stat.getFileType() == osl::FileStatus::Directory)
if (stat.getFileType() == osl::FileStatus::Directory) { aSubDirs[stat.getFileURL()][rProject] = rPotDir.concat("/").concat(sDirName);
if (includeProject(sDirName)) { else
handleDirectory( aFileNames.push_back(stat.getFileURL());
stat.getFileURL(), 1, sDirName, rPotDir.concat("/").concat(sDirName)); break;
} else if ( sDirName == "clone" ||
sDirName == "src" )
{
handleDirectory( stat.getFileURL(), -1, OString(), rPotDir);
}
}
break;
default:
if (stat.getFileType() == osl::FileStatus::Directory)
{
handleDirectory(
stat.getFileURL(), 2, rProject, rPotDir.concat("/").concat(sDirName));
}
else
{
aFileNames.push_back(stat.getFileURL());
}
break;
} }
} }
...@@ -409,6 +392,10 @@ void handleDirectory( ...@@ -409,6 +392,10 @@ void handleDirectory(
throw false; //TODO throw false; //TODO
} }
for (auto const& elem : aSubDirs)
handleDirectory(elem.first, nLevel + 1, elem.second.begin()->first,
elem.second.begin()->second);
//Remove empty pot directory //Remove empty pot directory
OUString sPoPath = OUString sPoPath =
OStringToOUString( OStringToOUString(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment