Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit f1d86dc

Browse files
committed
🐛 redownload-electron-bins.js: Correct path
Construct the atomRepoPath variable starting with __dirname, so that atomRepoPath is an absolute path. For example: '/Users/[username]/atom/package.json', versus '../../../../atom/package.json'. --- Explanation for why this is necessary: The require() and fs.existsSync() functions interpret relative paths differently. require() is relative to the current script's containing folder, (which is the same as __dirname), whereas 'fs.existsSync()' is relative to the working directory (which is the same as process.cwd()). When constructing the path to the Atom repo's main package.json, we should construct it as an absolute path, for consistency's sake. Otherwise the script will error out, or use the wrong package.json.
1 parent a88381b commit f1d86dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script/redownload-electron-bins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (typeof(downloadMksnapshotPath) !== 'undefined') {
1212
const path = require('path');
1313
const fs = require('fs');
1414

15-
const atomRepoPath = path.join('..', '..', '..', '..', 'atom', 'package.json');
15+
const atomRepoPath = path.join(__dirname, '..', '..', '..', '..', 'atom', 'package.json');
1616
const electronVersion = fs.existsSync(atomRepoPath) ? require(atomRepoPath).electronVersion : '6.1.12'
1717
// TODO: Keep the above "electronVersion" in sync with "electronVersion" from Atom's package.json
1818

0 commit comments

Comments
 (0)