[olympic/applib] Change applib run arguments

This commit is contained in:
Gary Talent 2023-12-10 21:33:45 -06:00
parent 6dec1bf5ed
commit e3b2c66d70
4 changed files with 15 additions and 24 deletions

View File

@ -9,6 +9,10 @@
#define OLYMPIC_PROJECT_NAME "OlympicProject"
#endif
#ifndef OLYMPIC_APP_NAME
#define OLYMPIC_APP_NAME "App"
#endif
#ifndef OLYMPIC_PROJECT_NAMESPACE
#define OLYMPIC_PROJECT_NAMESPACE project
#endif
@ -27,10 +31,8 @@
namespace olympic {
[[nodiscard]]
ox::StringView appName() noexcept;
ox::Error run(
ox::StringView project,
ox::StringView appName,
ox::StringView projectDataDir,
int argc,
@ -50,14 +52,14 @@ int WinMain() {
#else
int main(int argc, const char **argv) {
#endif
OX_INIT_DEBUG_LOGGER(loggerConn, olympic::appName())
OX_INIT_DEBUG_LOGGER(loggerConn, OLYMPIC_PROJECT_NAME " " OLYMPIC_APP_NAME)
#if OLYMPIC_LOAD_KEEL_MODULES
OLYMPIC_PROJECT_NAMESPACE::registerKeelModules();
#endif
#if OLYMPIC_LOAD_STUDIO_MODULES
OLYMPIC_PROJECT_NAMESPACE::registerStudioModules();
#endif
auto const err = olympic::run(olympic::appName(), OLYMPIC_PROJECT_DATADIR, argc, argv);
auto const err = olympic::run(OLYMPIC_PROJECT_NAME, OLYMPIC_APP_NAME, OLYMPIC_PROJECT_DATADIR, argc, argv);
oxAssert(err, "Something went wrong...");
if (err) {
oxErrf("Failure: {}\n", toStr(err));

View File

@ -12,17 +12,4 @@ namespace studio {
void registerModule(const studio::Module*) noexcept;
struct StudioOptions {
ox::String appName;
ox::String projectDataDir;
};
ox::Error run(StudioOptions&&);
ox::Error run(
ox::CRStringView appName,
ox::CRStringView projectDataDir,
int argc,
const char **argv);
}

View File

@ -12,6 +12,7 @@ add_library(
target_compile_definitions(
StudioAppLib PUBLIC
OLYMPIC_LOAD_STUDIO_MODULES=1
OLYMPIC_APP_NAME="Studio"
)
target_link_libraries(
StudioAppLib PUBLIC

View File

@ -80,6 +80,11 @@ ox::Error run(
return err;
}
struct StudioOptions {
ox::String appName;
ox::String projectDataDir;
};
ox::Error run(StudioOptions &&opts, int argc = 0, const char **argv = nullptr) {
return run(opts.appName, opts.projectDataDir, argc, argv);
}
@ -88,17 +93,13 @@ ox::Error run(StudioOptions &&opts, int argc = 0, const char **argv = nullptr) {
namespace olympic {
[[nodiscard]]
ox::StringView appName() noexcept {
return "Nostalgia Studio";
}
ox::Error run(
ox::StringView project,
ox::StringView appName,
ox::StringView projectDataDir,
int argc,
const char **argv) noexcept {
return studio::run(appName, projectDataDir, argc, argv);
return studio::run(ox::sfmt("{} {}", project, appName), projectDataDir, argc, argv);
}
}