Files
codeg/src/lib/path-utils.ts
xintaofei 9396127cd9 feat: add @ file mention support in chat input and unify directory attachment
Support typing "@" in the chat input to trigger a file list popup with
filtering, keyboard navigation, and file/directory attachment. Directories
from the sidebar file tree now attach as resource links instead of injecting
text into the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:43:27 +08:00

10 lines
379 B
TypeScript

export function joinFsPath(basePath: string, relPath: string): string {
if (!relPath) return basePath
const separator = basePath.includes("\\") ? "\\" : "/"
const normalizedRel = relPath.replace(/[\\/]/g, separator)
if (basePath.endsWith("/") || basePath.endsWith("\\")) {
return `${basePath}${normalizedRel}`
}
return `${basePath}${separator}${normalizedRel}`
}