Skip to content

The open source coding agent.

TypeScript

fix(app): windows path handling issues

Adam46de1ed3b60c
diff --git a/packages/util/src/path.ts b/packages/util/src/path.ts
index 2da8028b46a..1ac106f2186 100644
--- a/packages/util/src/path.ts
+++ b/packages/util/src/path.ts
@@ -7,7 +7,8 @@ export function getFilename(path: string | undefined) {
export function getDirectory(path: string | undefined) {
if (!path) return ""
- const parts = path.split("/")
+ const trimmed = path.replace(/[\/\\]+$/, "")
+ const parts = trimmed.split(/[\/\\]/)
return parts.slice(0, parts.length - 1).join("/") + "/"
}