wip(desktop): progress
This commit is contained in:
parent
0d0c20e673
commit
1bc1e56da3
6 changed files with 240 additions and 151 deletions
|
|
@ -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]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue