Allowed load: to load paths.

This commit is contained in:
Devine Lu Linvega 2017-11-08 19:37:45 +13:00
parent 041e9cf597
commit 563fe93571

View File

@ -5,10 +5,13 @@ function IO()
this.image = null;
this.methods.load = new Method("load","browser","Press enter to open the file browser.",function(q){
var filepath = dialog.showOpenDialog({properties: ['openFile']});
var filepath = q ? [q] : dialog.showOpenDialog({properties: ['openFile']});
if(!filepath){ console.log("Nothing to load"); return; }
console.log("Loaded",filepath)
fs.readFile(filepath[0], 'utf-8', (err, data) => {
if(err){ alert("An error ocurred reading the file :" + err.message); return; }
var img = new Image();