Skip to content

πŸ†™ Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.

Fix windows separator

Nayam Amarshe0dd5b029d07d
diff --git a/common/get-file-name.ts b/common/get-file-name.ts
index 4a826f5..49e4b4f 100644
--- a/common/get-file-name.ts
+++ b/common/get-file-name.ts
@@ -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];
}