native_background.ts: Fail if profile couldn't be found on linux

profilecmd.code is not necessarily different from 0 if `find` doesn't
return any results. This commit makes sure getProfileDir() checks for
such situations.
This commit is contained in:
glacambre 2019-02-13 13:22:58 +01:00
parent 4734214f9e
commit aed8338427
No known key found for this signature in database
GPG key ID: B9625DB1767553AC

View file

@ -460,8 +460,10 @@ export async function getProfileDir() {
hacky_profile_finder =
"find ../../../Library/'Application Support'/Firefox/Profiles -maxdepth 2 -name .parentlock"
let profilecmd = await run(hacky_profile_finder)
if (profilecmd.code != 0) {
throw new Error("Profile not found")
if (profilecmd.code != 0 || profilecmd.content.length == 0) {
throw new Error(
"Profile not found, please set your 'profiledir' setting.",
)
} else {
// Remove trailing newline
profilecmd.content = profilecmd.content.trim()