Check extension before setting title

This commit is contained in:
apple502j 2019-09-13 22:29:21 +09:00 committed by GitHub
parent 9ec118ea48
commit 9ef9d8fce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,13 +94,15 @@ const createMainWindow = () => {
const userChosenPath = dialog.showSaveDialog(window, options);
if (userChosenPath) {
item.setSavePath(userChosenPath);
const newProjectTitle = path.basename(userChosenPath, extName);
webContents.send('setTitleFromSave', {title: newProjectTitle});
if (extNameNoDot.toUpperCase() == "SB3") { // when a project is downloaded, not an asset
const newProjectTitle = path.basename(userChosenPath, extName);
webContents.send('setTitleFromSave', {title: newProjectTitle});
// "setTitleFromSave" will set the project title but GUI has already reported the telemetry event
// using the old title. This call lets the telemetry client know that the save was actually completed
// and the event should be committed to the event queue with this new title.
telemetry.projectSaveCompleted(newProjectTitle);
// "setTitleFromSave" will set the project title but GUI has already reported the telemetry event
// using the old title. This call lets the telemetry client know that the save was actually completed
// and the event should be committed to the event queue with this new title.
telemetry.projectSaveCompleted(newProjectTitle);
}
} else {
item.cancel();
telemetry.projectSaveCanceled();