Commit 66274bfb authored by carlosperate's avatar carlosperate

Electron: Prioritise server launch, for better response.

parent 581ea806
......@@ -152,8 +152,7 @@ def create_run_batch_file():
entry point built by Electron.
"""
batch_text = "@echo off\n" + \
"start %s" % os.path.join(project_root_dir, "arduexec",
"ardublockly.exe")
"start %s" % os.path.join("arduexec", "ardublockly.exe")
batch_location = os.path.join(project_root_dir, "ardublockly_run.bat")
try:
batch_file = open(batch_location, "w")
......
......@@ -28,6 +28,8 @@ var mainWindowState = windowStateKeeper('main', {
});
app.on('ready', function () {
server.startServer();
mainWindow = new BrowserWindow({
x: mainWindowState.x,
y: mainWindowState.y,
......@@ -52,15 +54,12 @@ app.on('ready', function () {
if (env.name === 'development') {
appMenu.setArdublocklyMenu(true);
//mainWindow.openDevTools();
} else {
appMenu.setArdublocklyMenu();
}
mainWindow.loadUrl('http://localhost:8000/ardublockly');
server.startServer();
mainWindow.on('close', function () {
mainWindowState.saveState(mainWindow);
mainWindow = null;
......@@ -68,7 +67,7 @@ app.on('ready', function () {
});
app.on('window-all-closed', function () {
server.stopServer()
server.stopServer();
// Might need to add OS X exception
// https://github.com/atom/electron/issues/1357
app.quit();
......
......@@ -32,8 +32,8 @@ function getServerExecLocation() {
var ardublocklyRootDir = jetpack.dir(__dirname);
var oldArdublocklyRootDir = '';
while (ardublocklyRootDir.path() != oldArdublocklyRootDir) {
console.log(tag + 'Search for Ardublockly project root dir: ' +
ardublocklyRootDir.cwd());
//console.log(tag + 'Search for Ardublockly project root dir: ' +
// ardublocklyRootDir.cwd());
// Check if file /ardublokly/index.html exists within current path
if (jetpack.exists(
ardublocklyRootDir.path('ardublockly', 'index.html'))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment