Merge pull request #12872 from desktop/why-so-noisy-friend

Tidy up log messages around scanning for installed editors
This commit is contained in:
Markus Olsson 2021-08-31 15:56:44 +02:00 committed by GitHub
commit 6d974afa44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,15 +131,28 @@ async function findApplication(
): Promise<string | null> {
for (const identifier of editor.bundleIdentifiers) {
try {
const installPath = await appPath(identifier)
const exists = await pathExists(installPath)
if (exists) {
// app-path not finding the app isn't an error, it just means the
// bundle isn't registered on the machine.
// https://github.com/sindresorhus/app-path/blob/0e776d4e132676976b4a64e09b5e5a4c6e99fcba/index.js#L7-L13
const installPath = await appPath(identifier).catch(e =>
e.message === "Couldn't find the app"
? Promise.resolve(null)
: Promise.reject(e)
)
if (installPath === null) {
return null
}
if (await pathExists(installPath)) {
return installPath
}
log.debug(`App installation for ${editor} not found at '${installPath}'`)
log.debug(
`App installation for ${editor.name} not found at '${installPath}'`
)
} catch (error) {
log.debug(`Unable to locate ${editor} installation`, error)
log.debug(`Unable to locate ${editor.name} installation`, error)
}
}