mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-22 23:36:46 +08:00
Upload source code of tools
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#include "Codepack.h"
|
||||
|
||||
LazyList<FilePath> SearchFiles(
|
||||
const Folder& folder,
|
||||
const WString& extension,
|
||||
List<WString>& exceptions
|
||||
)
|
||||
{
|
||||
auto files = Ptr(new List<File>);
|
||||
auto folders = Ptr(new List<Folder>);
|
||||
folder.GetFiles(*files.Obj());
|
||||
folder.GetFolders(*folders.Obj());
|
||||
|
||||
return LazyList<File>(files)
|
||||
.Select([](const File& file)
|
||||
{
|
||||
return file.GetFilePath();
|
||||
})
|
||||
.Where([&](const FilePath& filePath)
|
||||
{
|
||||
return From(exceptions)
|
||||
.All([&](const WString& except)
|
||||
{
|
||||
return INVLOC.FindFirst(filePath.GetFullPath(), except, Locale::IgnoreCase).key == -1;
|
||||
});
|
||||
})
|
||||
.Where([=](const FilePath& path)
|
||||
{
|
||||
return INVLOC.EndsWith(path.GetName(), extension, Locale::IgnoreCase);
|
||||
})
|
||||
.Concat(
|
||||
LazyList<Folder>(folders)
|
||||
.SelectMany([&](const Folder& folder)
|
||||
{
|
||||
return SearchFiles(folder, extension, exceptions);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
LazyList<FilePath> GetCppFiles(
|
||||
const FilePath& folder,
|
||||
List<WString>& exceptions
|
||||
)
|
||||
{
|
||||
return SearchFiles(folder, L".cpp", exceptions);
|
||||
}
|
||||
|
||||
LazyList<FilePath> GetHeaderFiles(
|
||||
const FilePath& folder,
|
||||
List<WString>& exceptions
|
||||
)
|
||||
{
|
||||
return SearchFiles(folder, L".h", exceptions);
|
||||
}
|
||||
Reference in New Issue
Block a user