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