1 #include "OdbServerAppBase.h"
6 using namespace std::filesystem;
8 namespace Odb::Lib::App
10 OdbAppBase::OdbAppBase(
int argc,
char* argv[])
11 : m_designCache(DEFAULT_DESIGNS_DIR)
12 , m_commandLineArgs(argc, argv)
14 GOOGLE_PROTOBUF_VERIFY_VERSION;
17 OdbAppBase::~OdbAppBase()
19 Logger::instance()->stop();
20 google::protobuf::ShutdownProtobufLibrary();
23 const OdbDesignArgs& OdbAppBase::args()
const
25 return m_commandLineArgs;
28 DesignCache& OdbAppBase::designs()
33 Utils::ExitCode OdbAppBase::Run()
36 Logger::instance()->logLevel(Logger::Level::Info);
37 Logger::instance()->start();
40 if (!args().designsDir().empty())
42 designs().setDirectory(args().designsDir());
46 if (!args().loadDesign().empty())
52 designs().GetFileArchive(args().loadDesign());
53 if (pFileArchive ==
nullptr)
55 logerror(
"Failed to load design specified in arguments \"" + args().loadDesign() +
"\"");
56 return Utils::ExitCode::FailedInitLoadDesign;
61 pFileArchive->SaveFileModel(
".",
"notused");
64 catch (filesystem_error& fe)
67 logerror(
"filesystem_error: \"" + args().loadDesign() +
"\" " + fe.what());
69 catch (std::exception& e)
72 logerror(
"Failed to load design specified in arguments \"" + args().loadDesign() +
"\"");
73 return Utils::ExitCode::FailedInitLoadDesign;
80 designs().loadAllDesigns(
false);
83 return Utils::ExitCode::Success;