diff options
| author | Adam <[email protected]> | 2025-10-28 06:20:43 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-28 15:29:15 -0500 |
| commit | 1da24f6adb7fce37af79678dd053090831fda2f2 (patch) | |
| tree | a0e23d30d4a4f9534ea9af0413b0b3055b2fb311 /packages/desktop/src/utils | |
| parent | e29dd27632da70d6e716fbca8a909b8361e8187f (diff) | |
| download | opencode-1da24f6adb7fce37af79678dd053090831fda2f2.tar.gz opencode-1da24f6adb7fce37af79678dd053090831fda2f2.zip | |
wip: desktop work
Diffstat (limited to 'packages/desktop/src/utils')
| -rw-r--r-- | packages/desktop/src/utils/path.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/desktop/src/utils/path.ts b/packages/desktop/src/utils/path.ts index 3ae48cdb3..d23568ae6 100644 --- a/packages/desktop/src/utils/path.ts +++ b/packages/desktop/src/utils/path.ts @@ -1,3 +1,5 @@ +import { useSync } from "@/context/sync" + export function getFilename(path: string) { if (!path) return "" const trimmed = path.replace(/[\/]+$/, "") @@ -6,8 +8,10 @@ export function getFilename(path: string) { } export function getDirectory(path: string) { + const sync = useSync() const parts = path.split("/") - return parts.slice(0, parts.length - 1).join("/") + const dir = parts.slice(0, parts.length - 1).join("/") + return dir ? sync.sanitize(dir + "/") : "" } export function getFileExtension(path: string) { |
