mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 02:12:07 +00:00
12 lines
385 B
TypeScript
12 lines
385 B
TypeScript
import path from "node:path";
|
|
import { isPathInside } from "./path-guards.js";
|
|
|
|
export function resolveSafeBaseDir(rootDir: string): string {
|
|
const resolved = path.resolve(rootDir);
|
|
return resolved.endsWith(path.sep) ? resolved : `${resolved}${path.sep}`;
|
|
}
|
|
|
|
export function isWithinDir(rootDir: string, targetPath: string): boolean {
|
|
return isPathInside(rootDir, targetPath);
|
|
}
|