mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-27 14:30:44 -07:00
Use consistent param names (#12517)
This commit is contained in:
committed by
GitHub
parent
5f1208ad81
commit
f05d937f39
@@ -233,7 +233,7 @@ export function shortenPath(filePath: string, maxLen: number = 35): string {
|
||||
|
||||
/**
|
||||
* Calculates the relative path from a root directory to a target path.
|
||||
* Ensures both paths are resolved before calculating.
|
||||
* If targetPath is relative, it is returned as-is.
|
||||
* Returns '.' if the target path is the same as the root directory.
|
||||
*
|
||||
* @param targetPath The absolute or relative path to make relative.
|
||||
@@ -244,10 +244,11 @@ export function makeRelative(
|
||||
targetPath: string,
|
||||
rootDirectory: string,
|
||||
): string {
|
||||
const resolvedTargetPath = path.resolve(targetPath);
|
||||
if (!path.isAbsolute(targetPath)) {
|
||||
return targetPath;
|
||||
}
|
||||
const resolvedRootDirectory = path.resolve(rootDirectory);
|
||||
|
||||
const relativePath = path.relative(resolvedRootDirectory, resolvedTargetPath);
|
||||
const relativePath = path.relative(resolvedRootDirectory, targetPath);
|
||||
|
||||
// If the paths are the same, path.relative returns '', return '.' instead
|
||||
return relativePath || '.';
|
||||
|
||||
Reference in New Issue
Block a user