Allowed load: to load paths.
This commit is contained in:
parent
041e9cf597
commit
563fe93571
@ -5,10 +5,13 @@ function IO()
|
|||||||
this.image = null;
|
this.image = null;
|
||||||
|
|
||||||
this.methods.load = new Method("load","browser","Press enter to open the file browser.",function(q){
|
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; }
|
if(!filepath){ console.log("Nothing to load"); return; }
|
||||||
|
|
||||||
|
console.log("Loaded",filepath)
|
||||||
|
|
||||||
fs.readFile(filepath[0], 'utf-8', (err, data) => {
|
fs.readFile(filepath[0], 'utf-8', (err, data) => {
|
||||||
if(err){ alert("An error ocurred reading the file :" + err.message); return; }
|
if(err){ alert("An error ocurred reading the file :" + err.message); return; }
|
||||||
var img = new Image();
|
var img = new Image();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user