Skip to content

Commit

Permalink
Feat/use latest nrfutil URLs (#1017)
Browse files Browse the repository at this point in the history
* Feat: bundle latest nrfutil wrapper
  • Loading branch information
kylebonnici authored Jun 21, 2024
1 parent 7733e7a commit 9bc66cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scripts/getNrfutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ const downloadFile = require('./downloadFile');

const allConfigs = {
win32: {
url: 'https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-windows/nrfutil.exe',
url: 'https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/x86_64-pc-windows-msvc/nrfutil.exe',
localFile: 'nrfutil.exe',
makeFileExecutable: false,
},
darwin: {
url: 'https://developer.nordicsemi.com/.pc-tools/nrfutil/universal-osx/nrfutil',
url: 'https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/universal-apple-darwin/nrfutil',
localFile: 'nrfutil',
makeFileExecutable: true,
},
linux: {
url: 'https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil',
url: 'https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/x86_64-unknown-linux-gnu/nrfutil',
localFile: 'nrfutil',
makeFileExecutable: true,
},
Expand Down
15 changes: 14 additions & 1 deletion src/main/configureElectronApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,21 @@ const initNrfutil = () => {

const nrfutilBundled = path.join(getBundledResourcesDir(), binName);
const nrfutilInAppPath = path.join(getUserDataDir(), binName);
if (!fse.existsSync(nrfutilInAppPath)) {
const nrfutilBundledStats = fse.statSync(nrfutilBundled);

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

if (noNrfutilInstalled || installedNrfutilOlderThenBundledNrfutil) {
fse.copyFileSync(nrfutilBundled, nrfutilInAppPath);
fse.utimes(
nrfutilInAppPath,
nrfutilBundledStats.atime,
nrfutilBundledStats.mtime
);
logger.info('update nrfutil exe');
}

const nrfutilBundledSandboxes = path.join(
Expand Down

0 comments on commit 9bc66cb

Please sign in to comment.