Skip to content

Commit b30b2b3

Browse files
committed
Saving some files. This commit partially broken.
1 parent f513779 commit b30b2b3

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

app/js/binary.operations.js

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function binaryConvertVersionToShow(version) {
1919
}
2020

2121
/**
22+
* Gets version of a binary
2223
* @param {string} path - path to php binary
2324
* @param {string} replaced - replacing . with : (configstore workaround)
2425
*/
@@ -48,6 +49,9 @@ function binaryGetVersion(path, replaced) {
4849
return false;
4950
}
5051

52+
/**
53+
* Generate an HTML template of a listing line
54+
*/
5155
function binaryLineGetTemplate(version, path, inUse) {
5256
return [
5357
'<tr ' + (inUse ? 'class="info"' : '') + '>',

app/js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ $(() => {
5858
if (isMainWindow) {
5959
updatePhpPath();
6060
/* @@@@@@ this is a test */
61-
phpPath = './php/osx/php';
61+
phpPath = Path.join(__dirname, 'php/osx/php');
6262
}
6363

6464
// Set missing settings to default

app/js/main.functions.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function runCode() {
119119
const simulateFilename = Path.join(chdir, dummyName);
120120

121121
// Simulate php path variables
122+
// @TODO may be replaced by chdir option in execFile
122123
let simulateEnv = 'chdir(\'' + chdir + '\'); ';
123124
simulateEnv += '$_SERVER["DOCUMENT_ROOT"] = \'' + chdir + '\'; ';
124125
simulateEnv += '$_SERVER["PHP_SELF"] = \'' + simulateFilename + '\'; ';
@@ -132,19 +133,19 @@ function runCode() {
132133
// Creates temporary file to run
133134
fs.writeFileSync(tmpFile, code);
134135

135-
// Activates error reporting
136-
const runtimeOpts = ' -d"error_reporting=E_ALL" -d"display_errors=On" "';
137-
138136
// Prepares PHP call
139-
const commandToRun = '"' + phpPath + '"' + runtimeOpts + tmpFile + '"';
137+
// const commandToRun = Path.resolve(phpPath);
138+
const commandToRun = phpPath;
140139

141-
// Runs the code in /bin/sh
142-
runner.exec(commandToRun, (err, phpResponse, stderr) => {
140+
// Activates error reporting
141+
const runtimeOpts = ['-d"error_reporting=E_ALL"', '-d"display_errors=On"', tmpFile];
142+
143+
// Runs the code in shell
144+
runner.execFile(commandToRun, runtimeOpts, (err, phpResponse, stderr) => {
143145
fs.unlink(tmpFile);
144146
// User doesn't need to know where the file is
145147
setOutput(phpResponse.replace(new RegExp(' in ' + tmpFile, 'g'), ''));
146148
setBusy(false);
147-
148149
// Prevent link default (if returned output has links)
149150
preventLinkDefault();
150151
});

app/main.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
// Libraries
55
const electron = require('electron');
6-
const app = electron.app;
7-
const Tray = electron.Tray;
8-
const Menu = electron.Menu;
9-
const BrowserWindow = electron.BrowserWindow;
6+
const { app, Tray, Menu, BrowserWindow } = electron;
107
const ipc = electron.ipcMain;
118
const dialog = electron.Dialog;
129
const Path = require('path');
@@ -37,9 +34,6 @@ const locales = {
3734
'pt-BR': 'Português (Brasil)',
3835
};
3936

40-
// Force quit variable (quitting deppends on app mode)
41-
let forceQuit = false;
42-
4337
/**
4438
* Starting app
4539
*/
@@ -239,7 +233,6 @@ ipc.on('asynchronous-message', (evt, arg) => {
239233

240234
// Forces the quit
241235
function terminateApp() {
242-
forceQuit = true;
243236
app.quit();
244237
}
245238

app/php/osx/php

11.1 MB
Binary file not shown.

0 commit comments

Comments
 (0)