diff --git a/packages/tui/src/component/dialog-status.tsx b/packages/tui/src/component/dialog-status.tsx index 6c8fabdbb3a3..8d494370f60d 100644 --- a/packages/tui/src/component/dialog-status.tsx +++ b/packages/tui/src/component/dialog-status.tsx @@ -1,5 +1,6 @@ import { TextAttributes } from "@opentui/core" import { fileURLToPath } from "bun" +import path from "node:path" import { useTheme } from "../context/theme" import { useDialog } from "../ui/dialog" import { useSync } from "../context/sync" @@ -19,15 +20,13 @@ export function DialogStatus() { const result = list.map((item) => { const value = typeof item === "string" ? item : item[0] if (value.startsWith("file://")) { - const path = fileURLToPath(value) - const parts = path.split("/") - const filename = parts.pop() || path + const filePath = fileURLToPath(value) + const filename = path.basename(filePath) if (!filename.includes(".")) return { name: filename } const basename = filename.split(".")[0] if (basename === "index") { - const dirname = parts.pop() - const name = dirname || basename - return { name } + const dirname = path.basename(path.dirname(filePath)) + return { name: dirname || basename } } return { name: basename } }