Skip to content

Commit

Permalink
Fix nrfutil always being overwritten
Browse files Browse the repository at this point in the history
Because `nrfutilInAppPath` is always a string containing something,
`installedNrfutilOlderThenBundledNrfutil` was always truthy, causing
nrfutil to be always overwritten by the bundled version.
  • Loading branch information
datenreisender committed Oct 25, 2024
1 parent cd7e2d3 commit 0567f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/configureElectronApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ const initNrfutil = () => {
const nrfutilInAppPath = path.join(getUserDataDir(), binName);
const nrfutilBundledStats = fse.statSync(nrfutilBundled);

const noNrfutilInstalled = !fse.existsSync(nrfutilInAppPath);
const nrfutilInstalled = fse.existsSync(nrfutilInAppPath);
const installedNrfutilOlderThenBundledNrfutil =
nrfutilInAppPath ||
nrfutilInstalled &&
Math.round(nrfutilBundledStats.mtimeMs) >
Math.round(fse.statSync(nrfutilInAppPath).mtimeMs);

if (noNrfutilInstalled || installedNrfutilOlderThenBundledNrfutil) {
if (!nrfutilInstalled || installedNrfutilOlderThenBundledNrfutil) {
fse.copyFileSync(nrfutilBundled, nrfutilInAppPath);
fse.utimes(
nrfutilInAppPath,
Expand Down

0 comments on commit 0567f03

Please sign in to comment.