Skip to content

Commit

Permalink
Merge pull request #588 from NordicSemiconductor/fix_crash_on_monterey
Browse files Browse the repository at this point in the history
Fix crash on macOS Monterey
  • Loading branch information
datenreisender authored Oct 20, 2021
2 parents 4e23dab + e08bdf5 commit ba0fe36
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.7.2 - 2021-10-21
This version is released only for macOS.
### Fixed
- Crash on macOS Monterey.

## 3.7.1 - 2021-09-08
### Added
- Warning when launching outdated apps which are still using the old app
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nrfconnect",
"version": "3.7.1",
"version": "3.7.2",
"description": "nRF Connect for PC",
"repository": {
"type": "git",
Expand Down
14 changes: 11 additions & 3 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ require('./setUserDataDir');

const { existsSync } = require('fs');
const { resolve } = require('path');
const semver = require('semver');
const os = require('os');

const { execPath } = process;

Expand All @@ -54,11 +56,17 @@ const nRFjprogSearchPath = [
].find(existsSync);

if (nRFjprogSearchPath) {
const onMonterey =
os.platform() === 'darwin' && semver(os.release()).major >= 21;
const envVariableForLibPath = onMonterey
? 'DYLD_LIBRARY_PATH'
: 'LD_LIBRARY_PATH';

process.env.NRFJPROG_LIBRARY_PATH = nRFjprogSearchPath;
const original = process.env.LD_LIBRARY_PATH
? `:${process.env.LD_LIBRARY_PATH}`
const original = process.env[envVariableForLibPath]
? `:${process.env[envVariableForLibPath]}`
: '';
process.env.LD_LIBRARY_PATH = `${nRFjprogSearchPath}${original}`;
process.env[envVariableForLibPath] = `${nRFjprogSearchPath}${original}`;
}

const { Menu, ipcMain, dialog, app: electronApp } = require('electron');
Expand Down

0 comments on commit ba0fe36

Please sign in to comment.