diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-05-29 15:01:22 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-05-29 15:54:58 +0200 |
| commit | 0cb3d3446d1d8fcc98cdde78d7eff92cb4c4a207 (patch) | |
| tree | 85716ae7ac842cf50e2b3744ae12ecbe3c2bfa06 /gui/src | |
| parent | b70eddcd2d369beb6925534c17ee27d822c24721 (diff) | |
| download | mullvadvpn-0cb3d3446d1d8fcc98cdde78d7eff92cb4c4a207.tar.xz mullvadvpn-0cb3d3446d1d8fcc98cdde78d7eff92cb4c4a207.zip | |
Ignore non-existent directories when listing split tunneling apps
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/macos-split-tunneling.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gui/src/main/macos-split-tunneling.ts b/gui/src/main/macos-split-tunneling.ts index f66ac4838a..024876d7fe 100644 --- a/gui/src/main/macos-split-tunneling.ts +++ b/gui/src/main/macos-split-tunneling.ts @@ -127,8 +127,16 @@ export class MacOsSplitTunnelingAppListRetriever implements ISplitTunnelingAppLi * Returns contents of directory with results as absolute paths. */ private async readDirectory(applicationDir: string) { - const basenames = await fs.readdir(applicationDir); - return basenames.map((basename) => path.join(applicationDir, basename)); + try { + const basenames = await fs.readdir(applicationDir); + return basenames.map((basename) => path.join(applicationDir, basename)); + } catch (err) { + const e = err as NodeJS.ErrnoException; + if (e.code !== 'ENOENT' && e.code !== 'ENOTDIR') { + log.error(`Failed to read directory contents: ${applicationDir}`, err); + } + return []; + } } private async readApplicationBundlePlist(applicationBundlePath: string): Promise<Plist> { |
