Merge pull request #1549 from MoerAI/fix/windows-path-absolute-check

fix(hooks): use path.isAbsolute() for cross-platform path detection on Windows
This commit is contained in:
YeonGyu-Kim
2026-02-18 18:04:13 +09:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -1,11 +1,11 @@
import { existsSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { dirname, isAbsolute, join, resolve } from "node:path";
import { AGENTS_FILENAME } from "./constants";
export function resolveFilePath(rootDirectory: string, path: string): string | null {
if (!path) return null;
if (path.startsWith("/")) return path;
if (isAbsolute(path)) return path;
return resolve(rootDirectory, path);
}

View File

@@ -1,11 +1,11 @@
import { existsSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { dirname, isAbsolute, join, resolve } from "node:path";
import { README_FILENAME } from "./constants";
export function resolveFilePath(rootDirectory: string, path: string): string | null {
if (!path) return null;
if (path.startsWith("/")) return path;
if (isAbsolute(path)) return path;
return resolve(rootDirectory, path);
}