Skip to content

Commit

Permalink
fix: support dynamic application path (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
chbdetta authored and MarshallOfSound committed Sep 7, 2018
1 parent 0b07982 commit e9471f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { getPath } from './utils';
const { BrowserWindow } = remote || electron;

let IDMap = {};
const IDMapPath = path.resolve(getPath(), 'IDMap.json');
if (fs.existsSync(IDMapPath)) {
const getIDMapPath = () => path.resolve(getPath(), 'IDMap.json');
if (fs.existsSync(getIDMapPath())) {
try {
IDMap = JSON.parse(fs.readFileSync(IDMapPath, 'utf8'));
IDMap = JSON.parse(fs.readFileSync(getIDMapPath(), 'utf8'));
} catch (err) {
console.error('electron-devtools-installer: Invalid JSON present in the IDMap file');
}
Expand Down Expand Up @@ -51,7 +51,7 @@ const install = (extensionReference, forceDownload = false) => {
}
const name = BrowserWindow.addDevToolsExtension(extensionFolder); // eslint-disable-line
fs.writeFileSync(
IDMapPath,
getIDMapPath(),
JSON.stringify(Object.assign(IDMap, {
[chromeStoreID]: name,
})),
Expand Down

0 comments on commit e9471f9

Please sign in to comment.