Skip to content

Commit

Permalink
#219: Upgrade electron to v7, get env based on app path, and use app.…
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
bstein committed Aug 15, 2022
1 parent d39afc2 commit 64b4321
Show file tree
Hide file tree
Showing 6 changed files with 1,118 additions and 397 deletions.
2 changes: 1 addition & 1 deletion app/app/index.run.js
Expand Up @@ -283,7 +283,7 @@ export function runBlock($rootScope, $state, $window, $document, $translate, toa
}];

if (process.platform === 'darwin') {
const name = app.getName();
const name = app.name;
template.unshift({
label: name,
submenu: [{
Expand Down
4 changes: 2 additions & 2 deletions app/app/reports/reportsController.js
Expand Up @@ -29,7 +29,7 @@ import jetpack from 'fs-jetpack';
import os from 'os';
import path from 'path';
import {remote} from 'electron';
import env from '../../env';
import { getEnv } from '../../env';

const {app} = remote;
export class ReportsController {
Expand All @@ -43,7 +43,7 @@ export class ReportsController {
vm.$log = $log;
vm.$scope = $scope;
vm.Project = Project;
vm.env = env;
vm.env = getEnv(app.getAppPath());
vm.preloadPath = 'file://';
vm.reportDir = Project.getProjectDir();
vm.reportDirPath = path.resolve(vm.reportDir.path());
Expand Down
3 changes: 2 additions & 1 deletion app/background.js
Expand Up @@ -32,7 +32,7 @@

import { app } from 'electron';
import createWindow from './electron/window';
import env from './env';
import { getEnv } from './env';

app.on('ready', () => {

Expand All @@ -46,6 +46,7 @@ app.on('ready', () => {
}
});

const env = getEnv(app.getAppPath());
if (env.name === 'test') {
mainWindow.loadURL('file://' + __dirname + '/spec.html');
} else if (env.name === 'development') {
Expand Down
6 changes: 3 additions & 3 deletions app/env.js
Expand Up @@ -29,6 +29,6 @@

import jetpack from 'fs-jetpack';

const env = jetpack.cwd(__dirname).read('env.json', 'json');

export default env;
export function getEnv(appPath) {
return jetpack.cwd(appPath).read('env.json', 'json');
}

0 comments on commit 64b4321

Please sign in to comment.