[applib] Make run take args as a SpanView
This commit is contained in:
parent
edda8e010e
commit
1bf4f246c2
@ -41,8 +41,7 @@ ox::Error run(
|
||||
ox::StringView project,
|
||||
ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
int argc,
|
||||
char const**argv) noexcept;
|
||||
ox::SpanView<char const*> argv) noexcept;
|
||||
|
||||
}
|
||||
|
||||
@ -65,7 +64,11 @@ int main(int argc, char const**argv) {
|
||||
#if OLYMPIC_LOAD_STUDIO_MODULES
|
||||
OLYMPIC_PROJECT_NAMESPACE::registerStudioModules();
|
||||
#endif
|
||||
auto const err = olympic::run(OLYMPIC_PROJECT_NAME, OLYMPIC_APP_NAME, OLYMPIC_PROJECT_DATADIR, argc, argv);
|
||||
auto const err = olympic::run(
|
||||
OLYMPIC_PROJECT_NAME,
|
||||
OLYMPIC_APP_NAME,
|
||||
OLYMPIC_PROJECT_DATADIR,
|
||||
{argv, static_cast<size_t>(argc)});
|
||||
oxAssert(err, "Something went wrong...");
|
||||
if (err) {
|
||||
oxErrf("Failure: {}\n", toStr(err));
|
||||
|
@ -9,7 +9,9 @@ namespace keel {
|
||||
static ox::Vector<Module const*> mods;
|
||||
|
||||
void registerModule(Module const*mod) noexcept {
|
||||
if (mod) {
|
||||
mods.emplace_back(mod);
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
|
@ -81,8 +81,8 @@ static ox::Error pack(
|
||||
return {};
|
||||
}
|
||||
|
||||
static ox::Error run(int argc, char const**argv, ox::StringView projectDataDir) noexcept {
|
||||
ox::ClArgs const args(argc, argv);
|
||||
static ox::Error run(ox::SpanView<char const*> argv, ox::StringView projectDataDir) noexcept {
|
||||
ox::ClArgs const args(argv);
|
||||
auto const argSrc = args.getString("src", "");
|
||||
auto const argRomBin = args.getString("rom-bin", "");
|
||||
auto const argManifest = args.getString("manifest", "");
|
||||
@ -103,9 +103,8 @@ ox::Error run(
|
||||
[[maybe_unused]] ox::StringView project,
|
||||
[[maybe_unused]] ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
int argc,
|
||||
char const**argv) noexcept {
|
||||
return ::run(argc, argv, projectDataDir);
|
||||
ox::SpanView<char const*> argv) noexcept {
|
||||
return ::run(argv, projectDataDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,8 +52,7 @@ static ox::Error runApp(
|
||||
static ox::Error run(
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR projectDataDir,
|
||||
int,
|
||||
char const**) {
|
||||
ox::SpanView<const char*>) {
|
||||
// seed UUID generator
|
||||
auto const time = std::time(nullptr);
|
||||
ox::UUID::seedGenerator({
|
||||
@ -74,9 +73,8 @@ ox::Error run(
|
||||
ox::StringView project,
|
||||
ox::StringView appName,
|
||||
ox::StringView projectDataDir,
|
||||
int argc,
|
||||
char const**argv) noexcept {
|
||||
return studio::run(ox::sfmt("{} {}", project, appName), projectDataDir, argc, argv);
|
||||
ox::SpanView<char const*> args) noexcept {
|
||||
return studio::run(ox::sfmt("{} {}", project, appName), projectDataDir, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,9 @@ namespace studio {
|
||||
static ox::Vector<studio::Module const*> modules;
|
||||
|
||||
void registerModule(studio::Module const*mod) noexcept {
|
||||
if (mod) {
|
||||
modules.emplace_back(mod);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -238,18 +240,18 @@ void StudioUI::loadEditorMaker(studio::EditorMaker const&editorMaker) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void StudioUI::loadModule(studio::Module const*mod) noexcept {
|
||||
for (auto const&editorMaker : mod->editors(m_sctx)) {
|
||||
void StudioUI::loadModule(studio::Module const&mod) noexcept {
|
||||
for (auto const&editorMaker : mod.editors(m_sctx)) {
|
||||
loadEditorMaker(editorMaker);
|
||||
}
|
||||
for (auto &im : mod->itemMakers(m_sctx)) {
|
||||
for (auto &im : mod.itemMakers(m_sctx)) {
|
||||
m_newMenu.addItemMaker(std::move(im));
|
||||
}
|
||||
}
|
||||
|
||||
void StudioUI::loadModules() noexcept {
|
||||
for (auto const mod : modules) {
|
||||
loadModule(mod);
|
||||
loadModule(*mod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class StudioUI: public ox::SignalHandler {
|
||||
|
||||
void loadEditorMaker(studio::EditorMaker const&editorMaker) noexcept;
|
||||
|
||||
void loadModule(studio::Module const*mod) noexcept;
|
||||
void loadModule(studio::Module const&mod) noexcept;
|
||||
|
||||
void loadModules() noexcept;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user