1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-12 01:40:53 +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(
path: string,
withExtension: boolean = true,
) {
export default function getFilenameFromPath(path: string) {
if (!path) return "";
if (withExtension) return path.split("/").slice(-1)[0];
return path.split("/").slice(-1)[0].split(".").slice(0, -1).join(".");
const separator = path.includes("/") ? "/" : "\\";
return path.split(separator).slice(-1)[0];
}