From 5c8268b6f44e96ef1975999baac71c022875c321 Mon Sep 17 00:00:00 2001 From: Yuki Okita Date: Wed, 6 Aug 2025 02:01:01 +0900 Subject: feat: Multi-Directory Workspace Support (part 3: configuration in settings.json) (#5354) Co-authored-by: Allen Hutchison --- packages/cli/src/utils/resolvePath.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/cli/src/utils/resolvePath.ts (limited to 'packages/cli/src/utils') diff --git a/packages/cli/src/utils/resolvePath.ts b/packages/cli/src/utils/resolvePath.ts new file mode 100644 index 00000000..b26ed8fc --- /dev/null +++ b/packages/cli/src/utils/resolvePath.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as os from 'os'; +import * as path from 'path'; + +export function resolvePath(p: string): string { + if (!p) { + return ''; + } + let expandedPath = p; + if (p.toLowerCase().startsWith('%userprofile%')) { + expandedPath = os.homedir() + p.substring('%userprofile%'.length); + } else if (p === '~' || p.startsWith('~/')) { + expandedPath = os.homedir() + p.substring(1); + } + return path.normalize(expandedPath); +} -- cgit v1.2.3