[nostalgia/studio] Flesh out editor tab system and cleanup studio::Project to use exceptions instead of returning error codes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user