mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
22 lines
527 B
TypeScript
22 lines
527 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import * as os from 'node:os';
|
|
import * as path from 'node: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);
|
|
}
|