Break web generator to own cmake.

This commit is contained in:
jmsgrogan 2022-10-03 08:12:38 +01:00
parent bd60a28eef
commit ebd41bf4ee
14 changed files with 121 additions and 45 deletions

View file

@ -49,7 +49,7 @@ void GuiApplication::SetUpWidget()
auto tabbedPanel = TabbedPanelWidget::Create();
auto textEditor = TextEditorView::Create();
auto path = mMainApplication->GetCommandLineArgs()->GetLaunchPath();
auto path = mMainApplication->GetCommandLineArgs()->getLaunchPath();
path /= "out.txt";
textEditor->GetController()->SetSavePath(path);
textEditor->GetController()->SetLoadPath(path);

View file

@ -36,7 +36,7 @@ void MainApplication::Initialize(CommandLineArgsUPtr commandLineArgs, std::uniqu
}
mCommandLineArgs = std::move(commandLineArgs);
const auto launch_path = mCommandLineArgs->GetLaunchPath().string();
const auto launch_path = mCommandLineArgs->getLaunchPath().string();
FileLogger::GetInstance().SetWorkDirectory(launch_path);
FileLogger::GetInstance().Open();
@ -56,23 +56,23 @@ void MainApplication::Initialize(CommandLineArgsUPtr commandLineArgs, std::uniqu
void MainApplication::Run()
{
std::string program_type;
if(mCommandLineArgs->GetNumberOfArgs() > 1)
if(mCommandLineArgs->getNumberOfArgs() > 1)
{
program_type = mCommandLineArgs->GetArg(1);
program_type = mCommandLineArgs->getArg(1);
}
std::string input_path;
std::string output_path;
for(unsigned idx=1; idx<mCommandLineArgs->GetNumberOfArgs(); idx++)
for(unsigned idx=1; idx<mCommandLineArgs->getNumberOfArgs(); idx++)
{
auto arg = mCommandLineArgs->GetArg(idx);
if(arg == "-input" && mCommandLineArgs->GetNumberOfArgs() > idx+1)
auto arg = mCommandLineArgs->getArg(idx);
if(arg == "-input" && mCommandLineArgs->getNumberOfArgs() > idx+1)
{
input_path = mCommandLineArgs->GetArg(idx + 1);
input_path = mCommandLineArgs->getArg(idx + 1);
}
else if(arg == "-output" && mCommandLineArgs->GetNumberOfArgs() > idx+1)
else if(arg == "-output" && mCommandLineArgs->getNumberOfArgs() > idx+1)
{
output_path = mCommandLineArgs->GetArg(idx + 1);
output_path = mCommandLineArgs->getArg(idx + 1);
}
}

View file

@ -5,6 +5,7 @@ list(APPEND core_HEADERS
Color.h
CommandLineArgs.h
loggers/FileLogger.h
file_utilities/Directory.h
file_utilities/File.h
file_utilities/FileFormats.h
StringUtils.h
@ -17,6 +18,7 @@ list(APPEND core_LIB_INCLUDES
CommandLineArgs.cpp
data_structures/Tree.cpp
loggers/FileLogger.cpp
file_utilities/Directory.cpp
file_utilities/File.cpp
file_utilities/FileFormats.cpp
memory/SharedMemory.cpp

View file

@ -0,0 +1,17 @@
#include "Directory.h"
std::vector<Path> Directory::getFilesWithExtension(const Path& path, const std::string& extension)
{
std::vector<Path> paths;
if (std::filesystem::is_directory(path))
{
for (const auto& entry : std::filesystem::directory_iterator(path))
{
if (std::filesystem::is_regular_file(entry) && entry.path().extension() == extension)
{
paths.push_back(entry.path());
}
}
}
return paths;
}

View file

@ -0,0 +1,13 @@
#pragma once
#include <vector>
#include <filesystem>
using Path = std::filesystem::path;
class Directory
{
public:
static std::vector<Path> getFilesWithExtension(const Path& path, const std::string& extension);
};