Skip to content

Commit

Permalink
Use getAppPath() in Electron
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiemh committed May 17, 2024
1 parent a99442b commit 298ea37
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/app/src/emberapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ const { app, protocol } = require('electron');
const { join, dirname } = require('path');
const fs = require('fs');

const MAIN = process.env.EMBER_ELECTRON_LOCATION;
const INDX = join('./index.html');
const PATH = app.getAppPath();
const BASE = join(PATH, 'dist');
const INDX = join(BASE, 'index.html');

protocol.registerSchemesAsPrivileged([
{ scheme: 'ember', privileges: { standard: true, secure: true } },
]);

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

protocol.handle('ember', (req, fn) => {
protocol.registerFileProtocol('ember', (req, fn) => {

const FILE = req.url.substr(12);
const FULL = join(BASE, FILE);
Expand Down Expand Up @@ -70,7 +71,7 @@ app.on('browser-window-created', (e, window) => {

window.webContents.on('did-fail-load', (e, int, text, url) => {
setTimeout( () => {
window.loadURL(MAIN || INDX);
window.loadURL(process.env.EMBER_ELECTRON_LOCATION || INDX);
}, 1000);
});

Expand Down

0 comments on commit 298ea37

Please sign in to comment.