diff --git a/assets/iguana/iguana b/assets/iguana/iguana new file mode 100755 index 0000000..a392f3d Binary files /dev/null and b/assets/iguana/iguana differ diff --git a/assets/iguana/iguanaLinux b/assets/iguana/iguanaLinux new file mode 100755 index 0000000..eff23ed Binary files /dev/null and b/assets/iguana/iguanaLinux differ diff --git a/assets/js/iguana.js b/assets/js/iguana.js new file mode 100644 index 0000000..1209245 --- /dev/null +++ b/assets/js/iguana.js @@ -0,0 +1,10 @@ +//SuperNET iguana app launcher + +//var exec = require('child_process').exec +//exec does not return obj with stream but instead the whole buffer output from proc +//spawn returns objects with stderr and out streams +//for question contact ca333@keemail.me + +const spawn = require('child_process').spawn; +var iguana = path.join(__dirname, '/assets/iguana/iguana'); +//var os = require('os'); diff --git a/assets/js/startup.js b/assets/js/startup.js new file mode 100644 index 0000000..0e0bd80 --- /dev/null +++ b/assets/js/startup.js @@ -0,0 +1 @@ +//startup separator for superNET iguana diff --git a/main.js b/main.js index 0358da2..f4fd0fd 100644 --- a/main.js +++ b/main.js @@ -5,16 +5,44 @@ const electron = require('electron') const app = electron.app const BrowserWindow = electron.BrowserWindow +var fs = require('fs'); +var mkdirp = require('mkdirp'); + const path = require('path') const url = require('url') const os = require('os') //require('./assets/js/iguana.js'); //below code shall be separated into asset js for public version const spawn = require('child_process').spawn; +const exec = require('child_process').exec; var iguanaOSX = path.join(__dirname, '/assets/iguana/iguana'); var iguanaLinux = path.join(__dirname, '/assets/iguana/iguanaLinux'); var iguanaWin = path.join(__dirname, '/assets/iguana/iguana'); +if (os.platform() === 'darwin') { + var iguanaDir = process.env.HOME + '/Library/Application Support/iguana' +} +if (os.platform() === 'linux') { + var iguanaDir = process.env.HOME + '.iguana' +} +if (os.platform() === 'win32') { + var iguanaDir = process.env.APPDATA + '/iguana' +} + +console.log(iguanaDir); + +mkdirp(iguanaDir, function (err) { + if (err) + console.error(err) + else + fs.readdir(iguanaDir, (err, files) => { + files.forEach(file => { + console.log(file); + }); + }) +}); + + let mainWindow @@ -46,10 +74,12 @@ function createWindow () { //ex(iguanaWin) //specify binary in startup //} if (os.platform() === 'linux') { - ig = spawn(iguanaLinux); + process.chdir(iguanaDir); + ig = spawn(iguanaLinux); } if (os.platform() === 'darwin') { - ig = spawn(iguanaOSX); + process.chdir(iguanaDir); + ig = spawn(iguanaOSX); } //}if (os.platform() === 'freeBSD') { //ex(iguanaFreeBSD) @@ -77,4 +107,4 @@ app.on('activate', function () { if (mainWindow === null) { createWindow() } -}) +}) \ No newline at end of file diff --git a/package.json b/package.json index c998c50..231d233 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ }, "dependencies": { "jquery": "^2.2.4", + "mkdirp": "^0.5.1", "toastr": "^2.1.2" } }