[nostalgia/studio] Flesh out editor tab system and cleanup studio::Project to use exceptions instead of returning error codes

This commit is contained in:
2019-11-26 23:15:02 -06:00
parent aa34239eb5
commit f634c208ac
12 changed files with 218 additions and 122 deletions

View File

@@ -20,8 +20,8 @@ const QString NewWorldWizard::FIELD_WORLD_PATH = "World.WorldPath";
NewWorldWizard::NewWorldWizard(const Context *ctx) {
addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) {
worldName = PATH_ZONES + worldName;
auto [stat, err] = ctx->project->stat(worldName);
if (err) {
auto exists = ctx->project->exists(worldName);
if (exists) {
this->showValidationError(tr("World already exists: %1").arg(worldName));
return 1;
}

View File

@@ -31,9 +31,8 @@ QVector<WizardMaker> WorldEditorPlugin::newWizards(const Context *ctx) {
qDebug() << "creating Region";
auto path = PATH_ZONES + w->field(NewWorldWizard::FIELD_WORLD_PATH).toString();
Region rgn;
oxReturnError(ctx->project->mkdir(PATH_ZONES));
ctx->project->saveRomFs();
oxReturnError(ctx->project->writeObj(path, &rgn));
ctx->project->mkdir(PATH_ZONES);
ctx->project->writeObj(path, &rgn);
return OxError(0);
}
}