File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,11 @@ const createMainWindow = () => {
104
104
const extNameNoDot = extName . replace ( / ^ \. / , '' ) ;
105
105
options . filters = [ getFilterForExtension ( extNameNoDot ) ] ;
106
106
}
107
- const userChosenPath = dialog . showSaveDialog ( window , options ) ;
107
+ const userChosenPath = dialog . showSaveDialogSync ( window , options ) ;
108
108
if ( userChosenPath ) {
109
+ // WARNING: `setSavePath` on this item is only valid during the `will-download` event. Calling the async
110
+ // version of `showSaveDialog` means the event will finish before we get here, so `setSavePath` will be
111
+ // ignored. For that reason we need to call `showSaveDialogSync` above.
109
112
item . setSavePath ( userChosenPath ) ;
110
113
if ( isProjectSave ) {
111
114
const newProjectTitle = path . basename ( userChosenPath , extName ) ;
@@ -125,7 +128,7 @@ const createMainWindow = () => {
125
128
} ) ;
126
129
127
130
webContents . on ( 'will-prevent-unload' , ev => {
128
- const choice = dialog . showMessageBox ( window , {
131
+ const choice = dialog . showMessageBoxSync ( window , {
129
132
type : 'question' ,
130
133
message : 'Leave Scratch?' ,
131
134
detail : 'Any unsaved changes will be lost.' ,
You can’t perform that action at this time.
0 commit comments