mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-30 22:00:53 +08:00
@@ -1,7 +1,7 @@
|
||||
export function getFilename(path: string | undefined) {
|
||||
if (!path) return ""
|
||||
const trimmed = path.replace(/[\/]+$/, "")
|
||||
const parts = trimmed.split("/")
|
||||
const trimmed = path.replace(/[\/\\]+$/, "")
|
||||
const parts = trimmed.split(/[\/\\]/)
|
||||
return parts[parts.length - 1] ?? ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user