Skip to content

Commit

Permalink
Fix Generate button malfunction
Browse files Browse the repository at this point in the history
+ fallback autosave to proper filename
  • Loading branch information
mborik committed Nov 20, 2022
1 parent 86adabc commit afd7fd3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
34 changes: 17 additions & 17 deletions src/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ export default class Compiler extends CompilerRender implements CompilerOptions
this.onPlayerAddressChanged();
});

this.dialog.find('.apply').click(async () => {
this.dialog.modal('hide');
await this.compile();
return true;
});

this.onIncludePlayerChanged();
}

Expand Down Expand Up @@ -219,6 +213,12 @@ export default class Compiler extends CompilerRender implements CompilerOptions
.before($('<div/>')
.addClass('modal-backdrop in').css('z-index', '1030'));

this.dialog.find('.apply').click(() => {
this.dialog.modal('hide');
this.compile();
return true;
});

}, this)).on('hide.bs.modal', () => {
this.dialog.prev('.modal-backdrop').remove();
this.dialog.find('.modal-footer>.btn').off();
Expand All @@ -233,7 +233,7 @@ export default class Compiler extends CompilerRender implements CompilerOptions
});
}

async compile() {
compile() {
this.openOutputLog();

const optiLogger = this.verbose ? (msg: string) => {
Expand All @@ -253,18 +253,18 @@ export default class Compiler extends CompilerRender implements CompilerOptions
this.playerData = null;

this.composeSongData();

if (this.includePlayer) {
try {
await this.preparePlayer();
}
catch (error) {
this.log(error, true);
return;
}
if (!this.includePlayer) {
this.finalizeOutputBinary();
return;
}

this.finalizeOutputBinary();
this.preparePlayer()
.then(() => {
this.finalizeOutputBinary();
})
.catch((error) => {
this.log(error, true);
});
}

private log(str: string, error: boolean = false) {
Expand Down
3 changes: 2 additions & 1 deletion src/tracker/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ export class STMFile {
//---------------------------------------------------------------------------------------
public getFixedFileName(): string {
return this._fixFileName(
this.fileName || this._parent.songTitle || i18n.app.filedialog.untitled
(this.fileName !== constants.AUTOSAVE_FILENAME && this.fileName) ||
this._parent.songTitle || i18n.app.filedialog.untitled
);
}

Expand Down

0 comments on commit afd7fd3

Please sign in to comment.