From 563fe93571dca990af3dba65ec0707d8659682fc Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 8 Nov 2017 19:37:45 +1300 Subject: [PATCH] Allowed load: to load paths. --- sources/scripts/modules/io.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/scripts/modules/io.js b/sources/scripts/modules/io.js index bb9936f..cd3c8db 100644 --- a/sources/scripts/modules/io.js +++ b/sources/scripts/modules/io.js @@ -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();