From 395dd2bca46c6f8327d6753521c8b9bc9aa6b741 Mon Sep 17 00:00:00 2001 From: charliva Date: Fri, 1 Feb 2019 17:36:36 +0100 Subject: [PATCH] Issue #267 and performance improvement --- app/scripts/services/utils.js | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index 50f0feb7d..e2e68ee54 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -871,28 +871,24 @@ angular.module('icestudio') }; this.newWindow = function(filepath, local) { - var execPath = process.execPath; - var command = [ coverPath(execPath) ]; - if (execPath.endsWith('nw') || execPath.endsWith('nw.exe') || execPath.endsWith('nwjs Helper')) { - command.push(coverPath(nodePath.dirname(process.mainModule.filename))); - } - if (filepath) { - command.push(coverPath(filepath)); - } - /*var win = window.get(); - var position = { - x: win.x + 30, - y: win.y + 30 - }; - command.push(position.x + 'x' + position.y);*/ - if (local) { - command.push('local'); - } - nodeChildProcess.exec(command.join(' '), [], function(error/*, stdout/*, stderr*/) { - if (error) { - throw error; - } - }); + + var gui = require('nw.gui'); + + // Create a new window and get it + var new_win = gui.Window.open('index.html', { + "new_instance": true, + "position": "center", + "toolbar": false, + "width": 900, + "height": 600, + "show": true, + }); + + setTimeout(function (){ + this.focus(); + + }.bind(new_win),250); + }; this.coverPath = coverPath;