From cd742fbdaa4782923cdeb5b1ef62d9202a1eba21 Mon Sep 17 00:00:00 2001 From: Brandon Smith Date: Sat, 13 Oct 2018 10:52:55 -0400 Subject: [PATCH] Improve detection of selected editor on Windows (#3242) Improves upon previous work completed in #2631: - Add additional system default check: `JSFile` - Relax restriction on `.exe` file extension as it is an invalid assumption: Closes #3223 --- app/config/open.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/config/open.js b/app/config/open.js index f4ddf0f4..1e15a58f 100644 --- a/app/config/open.js +++ b/app/config/open.js @@ -25,8 +25,8 @@ if (process.platform === 'win32') { }); // Find UserChoice key - const userChoice = keys.filter(k => k.key.endsWith('UserChoice')); - return userChoice[0]; + const userChoice = keys.find(k => k.key.endsWith('UserChoice')); + return userChoice; }; const hasDefaultSet = async () => { @@ -44,8 +44,8 @@ if (process.platform === 'win32') { }); // Look for default program - const hasDefaultProgramConfigured = values.some( - value => value && typeof value === 'string' && value.endsWith('.exe') && !value.includes('WScript.exe') + const hasDefaultProgramConfigured = values.every( + value => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile') ); return hasDefaultProgramConfigured;