1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-23 23:21:05 +01:00

Fix windows separator

This commit is contained in:
Nayam Amarshe 2024-04-25 09:18:48 +05:30
parent e695e62875
commit 0dd5b029d0

View File

@ -1,8 +1,5 @@
export default function getFilenameFromPath( export default function getFilenameFromPath(path: string) {
path: string,
withExtension: boolean = true,
) {
if (!path) return ""; if (!path) return "";
if (withExtension) return path.split("/").slice(-1)[0]; const separator = path.includes("/") ? "/" : "\\";
return path.split("/").slice(-1)[0].split(".").slice(0, -1).join("."); return path.split(separator).slice(-1)[0];
} }