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
This commit is contained in:
Brandon Smith 2018-10-13 10:52:55 -04:00 committed by CHaBou
parent 23c4945a12
commit cd742fbdaa

View file

@ -25,8 +25,8 @@ if (process.platform === 'win32') {
}); });
// Find UserChoice key // Find UserChoice key
const userChoice = keys.filter(k => k.key.endsWith('UserChoice')); const userChoice = keys.find(k => k.key.endsWith('UserChoice'));
return userChoice[0]; return userChoice;
}; };
const hasDefaultSet = async () => { const hasDefaultSet = async () => {
@ -44,8 +44,8 @@ if (process.platform === 'win32') {
}); });
// Look for default program // Look for default program
const hasDefaultProgramConfigured = values.some( const hasDefaultProgramConfigured = values.every(
value => value && typeof value === 'string' && value.endsWith('.exe') && !value.includes('WScript.exe') value => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
); );
return hasDefaultProgramConfigured; return hasDefaultProgramConfigured;