diff options
Diffstat (limited to 'packages/desktop/src/utils/path.ts')
| -rw-r--r-- | packages/desktop/src/utils/path.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/desktop/src/utils/path.ts b/packages/desktop/src/utils/path.ts new file mode 100644 index 000000000..9c026ca41 --- /dev/null +++ b/packages/desktop/src/utils/path.ts @@ -0,0 +1,14 @@ +export function getFilename(path: string) { + const parts = path.split("/") + return parts[parts.length - 1] +} + +export function getDirectory(path: string) { + const parts = path.split("/") + return parts.slice(0, parts.length - 1).join("/") +} + +export function getFileExtension(path: string) { + const parts = path.split(".") + return parts[parts.length - 1] +} |
