add default file extension to save dialog to allow for native duplicate file warning

This commit is contained in:
pacocoursey 2018-07-07 17:15:35 -07:00
parent f7f7fb2aea
commit 4a7c704587

View File

@ -140,7 +140,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
this.save = function(content = this.tool.export())
{
dialog.showSaveDialog({title:"Save to .grid"},(fileName) => {
dialog.showSaveDialog({
title:"Save to .grid",
filters: [{name: "Dotgrid", extensions: ["grid", "dot"]}]
},(fileName) => {
if (fileName === undefined){ return; }
fileName = fileName.substr(-5,5) != ".grid" ? fileName+".grid" : fileName;
fs.writeFileSync(fileName, content);