From 19bd0a534de3124083278bd03c6ea5df13326cd2 Mon Sep 17 00:00:00 2001 From: throwaway96 <68320646+throwaway96@users.noreply.github.com> Date: Sat, 25 Nov 2023 19:39:40 -0500 Subject: [PATCH] service: add homebrewBaseDir to /getConfiguration Allows callers to determine where Homebrew Channel is installed. This will usually be /media/developer/apps. --- services/service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/service.ts b/services/service.ts index b5e4757..542aef5 100644 --- a/services/service.ts +++ b/services/service.ts @@ -30,6 +30,14 @@ import ServiceRemote from './webos-service-remote'; const kHomebrewChannelPackageId = rootAppInfo.id; const startDevmode = '/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh'; +const homebrewBaseDir = ((): string | null => { + try { + return path.resolve(__dirname, '../../../../'); + } catch (err) { + console.warn('getting homebrewBaseDir failed:', err); + return null; + } +})(); // Maps internal setting field name with filesystem flag name. type FlagName = string; @@ -439,6 +447,7 @@ function runService() { const flags = Object.fromEntries(await Promise.all(futureFlags)); return { root: process.getuid() === 0, + homebrewBaseDir, ...flags, }; }),