From 65e3e84583a6529e598f22ddd8947efd065c5b12 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Wed, 23 Aug 2023 11:51:05 +0300 Subject: [PATCH] add path constants for OS checkout, adevtool, (device) config dirs --- src/config/paths.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/config/paths.ts diff --git a/src/config/paths.ts b/src/config/paths.ts new file mode 100644 index 0000000..e940671 --- /dev/null +++ b/src/config/paths.ts @@ -0,0 +1,15 @@ +import assert from 'assert' +import path from 'path' + +export const OS_CHECKOUT_DIR = getOsCheckoutDir() + +function getOsCheckoutDir(): string { + let scriptDir = '/vendor/adevtool/src/config' + assert(__dirname.endsWith(scriptDir)) + return __dirname.substring(0, __dirname.length - scriptDir.length) +} + +export const ADEVTOOL_DIR = path.join(OS_CHECKOUT_DIR, 'vendor/adevtool') + +export const CONFIG_DIR = process.env['ADEVTOOL_CONFIG_DIR'] ?? path.join(ADEVTOOL_DIR, 'config') +export const DEVICE_CONFIG_DIR = path.join(CONFIG_DIR, 'device')