stuff-from-scratch/apps/console-main.cpp
2020-05-03 07:56:27 +01:00

37 lines
709 B
C++

#include <filesystem>
#include <unistd.h>
#include <iostream>
#include "CommandLineArgs.h"
#include "MainApplication.h"
int main(int argc, char *argv[])
{
CommandLineArgs command_line_args;
command_line_args.Process(argc, argv);
std::string program_type;
if(command_line_args.GetNumberOfArgs() > 1)
{
program_type = command_line_args.GetArg(1);
}
// Start the main app
auto main_app = MainApplication::Create();
main_app->Initialize(std::filesystem::current_path());
if(program_type == "server")
{
main_app->RunServer();
}
else if(program_type == "audio")
{
main_app->PlayAudio();
}
else
{
std::cerr << "Unknown program type" << std::endl;
}
main_app->ShutDown();
return 0;
}