diff options
| author | Adam <[email protected]> | 2025-10-13 06:09:02 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-14 07:15:08 -0500 |
| commit | bb82d4309435f2052e98531e8d955198fb1c55ba (patch) | |
| tree | 9455ff36a5fec5d147425c2b2fae982a82b94fca /packages/desktop/src/utils | |
| parent | 2893b6e3a58a25514bb8d75c68f893ea5f2b593a (diff) | |
| download | opencode-bb82d4309435f2052e98531e8d955198fb1c55ba.tar.gz opencode-bb82d4309435f2052e98531e8d955198fb1c55ba.zip | |
wip: desktop work
Diffstat (limited to 'packages/desktop/src/utils')
| -rw-r--r-- | packages/desktop/src/utils/path.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/desktop/src/utils/path.ts b/packages/desktop/src/utils/path.ts index 9c026ca41..3ae48cdb3 100644 --- a/packages/desktop/src/utils/path.ts +++ b/packages/desktop/src/utils/path.ts @@ -1,6 +1,8 @@ export function getFilename(path: string) { - const parts = path.split("/") - return parts[parts.length - 1] + if (!path) return "" + const trimmed = path.replace(/[\/]+$/, "") + const parts = trimmed.split("/") + return parts[parts.length - 1] ?? "" } export function getDirectory(path: string) { |
