Browse Source

os detector updated

now changes to the dir before running iguana
checks if the directory already exists or not
if doesn’t creates the dir
changes the dir specific to os, and starts iguana from that dir.
found in previous updates iguana binaries was not included, or somehow
was missing. added to this update.
ca333-dev
Satinder Grewal 8 years ago
parent
commit
c1e83372e2
  1. BIN
      assets/iguana/iguana
  2. BIN
      assets/iguana/iguanaLinux
  3. 10
      assets/js/iguana.js
  4. 1
      assets/js/startup.js
  5. 36
      main.js
  6. 1
      package.json

BIN
assets/iguana/iguana

Binary file not shown.

BIN
assets/iguana/iguanaLinux

Binary file not shown.

10
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');

1
assets/js/startup.js

@ -0,0 +1 @@
//startup separator for superNET iguana

36
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()
}
})
})

1
package.json

@ -19,6 +19,7 @@
},
"dependencies": {
"jquery": "^2.2.4",
"mkdirp": "^0.5.1",
"toastr": "^2.1.2"
}
}

Loading…
Cancel
Save