From 1bc1e56da379fdd9040dc40caac1a57ffe8d1197 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:52:39 -0600 Subject: wip(desktop): progress --- packages/util/src/path.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'packages/util/src') diff --git a/packages/util/src/path.ts b/packages/util/src/path.ts index fbb84878d..f7c46d4ef 100644 --- a/packages/util/src/path.ts +++ b/packages/util/src/path.ts @@ -1,16 +1,18 @@ -export function getFilename(path: string) { +export function getFilename(path: string | undefined) { if (!path) return "" const trimmed = path.replace(/[\/]+$/, "") const parts = trimmed.split("/") return parts[parts.length - 1] ?? "" } -export function getDirectory(path: string) { +export function getDirectory(path: string | undefined) { + if (!path) return "" const parts = path.split("/") return parts.slice(0, parts.length - 1).join("/") + "/" } -export function getFileExtension(path: string) { +export function getFileExtension(path: string | undefined) { + if (!path) return "" const parts = path.split(".") return parts[parts.length - 1] } -- cgit v1.2.3