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