Fix electron

This commit is contained in:
Scott E. Graves
2019-04-09 13:14:59 -05:00
parent 35a38977b6
commit 3a092a2b97
3 changed files with 15 additions and 14 deletions

View File

@@ -53,18 +53,18 @@
"not ie <= 11", "not ie <= 11",
"not op_mini all" "not op_mini all"
], ],
"main": "electron.js", "main": "public/electron.js",
"homepage": "./", "homepage": "./",
"build": { "build": {
"appId": "repertory-ui", "appId": "repertory-ui",
"artifactName": "${productName}_${version}_${os}_${arch}.${ext}", "artifactName": "${productName}_${version}_${os}_${arch}.${ext}",
"files": [ "files": [
"./electron.js", "./electron.js",
"./src/constants.js", "src/constants.js",
"build/**/*", "build/**/*",
"node_modules/**/*", "node_modules/**/*",
"./helpers.js", "src/helpers.js",
"./public/detect_linux.sh" "public/detect_linux.sh"
], ],
"linux": { "linux": {
"category": "Utility", "category": "Utility",

View File

@@ -2,19 +2,19 @@
const {app, BrowserWindow, Tray, nativeImage, Menu, dialog} = require('electron'); const {app, BrowserWindow, Tray, nativeImage, Menu, dialog} = require('electron');
const {ipcMain} = require('electron'); const {ipcMain} = require('electron');
const Constants = require('./src/constants'); const Constants = require('../src/constants');
const path = require('path'); const path = require('path');
const url = require('url'); const url = require('url');
require('electron-debug')(); require('electron-debug/index')();
const os = require('os'); const os = require('os');
const helpers = require('./helpers'); const helpers = require('../src/helpers');
const fs = require('fs'); const fs = require('fs');
const unzip = require('unzipper'); const unzip = require('unzipper');
const AutoLaunch = require('auto-launch'); const AutoLaunch = require('auto-launch');
require.extensions['.sh'] = function (module, filename) { require.extensions['.sh'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8'); module.exports = fs.readFileSync(filename, 'utf8');
}; };
const detectScript = require('./public/detect_linux.sh'); const detectScript = require('./detect_linux.sh');
// Keep a global reference of the window object, if you don't, the window will // Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected. // be closed automatically when the JavaScript object is garbage collected.
@@ -47,7 +47,6 @@ function setWindowVisibility(show) {
if (mainWindow.isMinimized()) { if (mainWindow.isMinimized()) {
mainWindow.restore(); mainWindow.restore();
} }
mainWindow.focus(); mainWindow.focus();
} else { } else {
mainWindow.hide(); mainWindow.hide();
@@ -83,9 +82,11 @@ function createWindow() {
app.dock.hide(); app.dock.hide();
} }
mainWindow.openDevTools();
// and load the index.html of the app. // and load the index.html of the app.
const startUrl = process.env.ELECTRON_START_URL || url.format({ const startUrl = process.env.ELECTRON_START_URL || url.format({
pathname: path.join(__dirname, '/build/index.html'), pathname: path.join(__dirname, '../build/index.html'),
protocol: 'file:', protocol: 'file:',
slashes: true slashes: true
}); });
@@ -436,9 +437,9 @@ ipcMain.on(Constants.IPC_Detect_Mounts, (event, data) => {
let image; let image;
if (driveInUse) { if (driveInUse) {
image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_both_mac.png' : '/build/logo_both.png')); image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '../build/logo_both_mac.png' : '../build/logo_both.png'));
} else { } else {
image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '/build/logo_mac.png' : '/build/logo.png')); image = nativeImage.createFromPath(path.join(__dirname, os.platform() === 'darwin' ? '../build/logo_mac.png' : '../build/logo.png'));
} }
mainWindowTray.setImage(image); mainWindowTray.setImage(image);

View File

@@ -1,10 +1,10 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const os = require('os'); const os = require('os');
const axios = require('axios'); const axios = require('axios/index');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const spawn = require('child_process').spawn; const spawn = require('child_process').spawn;
const Constants = require('./src/constants'); const Constants = require('./constants');
const tryParse = (j, def) => { const tryParse = (j, def) => {
try { try {