parent
55b1f2a582
commit
f31d93c365
1 changed files with 2 additions and 5 deletions
|
@ -115,16 +115,13 @@ export function svgPathToFile(path: string): Uint8Array {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FILENAME_REGEX = /^(?:file:)?(\/?.+[/\\])*(.+\..+)$/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file name from file path
|
* Get file name from file path
|
||||||
*
|
*
|
||||||
* @param path File path
|
* @param path File path
|
||||||
*/
|
*/
|
||||||
export function extractFileName(path: string): string {
|
export function extractFileName(path: string): string {
|
||||||
const m = path.match(FILENAME_REGEX)
|
if (path.startsWith('file:')) path = path.slice(5)
|
||||||
if (m) return m[2]
|
|
||||||
|
|
||||||
return ''
|
return path.split(/[\\/]/).pop()!
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue