From 81a1a15e5ee6547aaf4e9ac020a258b42a867eaa Mon Sep 17 00:00:00 2001 From: deicidus <> Date: Thu, 9 Jun 2022 11:36:03 -0700 Subject: [PATCH] improved self update feature --- scripts/features.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/features.js b/scripts/features.js index 6c182ca..4478e37 100644 --- a/scripts/features.js +++ b/scripts/features.js @@ -2,6 +2,11 @@ import { execSync, exec } from 'child_process' import { AO_MANUAL_PATH } from './manual.js' import { loadJsonFile } from './files.js' +import path from 'path' +import { fileURLToPath } from 'url' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = path.dirname(__filename) // Adds a line to .bashrc to make 'ao' an alias for 'ao-cli', to simplify using the AO from the command line export function installAoAlias() { @@ -15,7 +20,7 @@ export function installAoAlias() { } export async function getAoCliVersion() { - const packageJson = await loadJsonFile('./package.json') + const packageJson = await loadJsonFile(path.join(__dirname, '../package.json')) return packageJson.version }