diff --git a/electron/index.ts b/electron/index.ts index ecd958c..ffccd57 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -45,6 +45,9 @@ let customModelsFolderPath: string | undefined = undefined; let outputFolderPath: string | undefined = undefined; let saveOutputFolder = false; +// Slashes for use in directory names +const slash: string = getPlatform() === "win" ? "\\" : "/"; + // Prepare the renderer once the app is ready let mainWindow: BrowserWindow; app.on("ready", async () => { @@ -338,15 +341,11 @@ ipcMain.on(commands.DOUBLE_UPSCAYL, async (event, payload) => { const isDefaultModel = defaultModels.includes(model); // COPY IMAGE TO TMP FOLDER - const platform = getPlatform(); - const fullfileName = - platform === "win" - ? (payload.imagePath.split("\\").slice(-1)[0] as string) - : (payload.imagePath.split("/").slice(-1)[0] as string); + + const fullfileName = (payload.imagePath.split(slash).slice(-1)[0] as string); const fileName = parse(fullfileName).name; - const fileExt = parse(fullfileName).ext; const outFile = - outputDir + "/" + fileName + "_upscayl_16x_" + model + "." + saveImageAs; + outputDir + slash + fileName + "_upscayl_16x_" + model + "." + saveImageAs; // UPSCALE let upscayl = spawnUpscayl( @@ -474,7 +473,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => { const outFile = outputDir + - "/" + + slash + fileName + "_upscayl_" + scale + @@ -680,8 +679,8 @@ autoUpdater.on("update-downloaded", (event) => { // ffmpeg.path, // [ // "-i", -// inputDir + "/" + videoFileName, -// frameExtractionPath + "/" + "out%d.png", +// inputDir + slash + videoFileName, +// frameExtractionPath + slash + "out%d.png", // ], // { // cwd: undefined, diff --git a/electron/utils/getArguments.ts b/electron/utils/getArguments.ts index 1edb090..32d80dc 100644 --- a/electron/utils/getArguments.ts +++ b/electron/utils/getArguments.ts @@ -1,3 +1,6 @@ +import getPlatform from "../getPlatform"; +const slash: string = getPlatform() === "win" ? "\\" : "/"; + export const getSingleImageArguments = ( inputDir: string, fullfileName: string, @@ -10,7 +13,7 @@ export const getSingleImageArguments = ( ) => { return [ "-i", - inputDir + "/" + fullfileName, + inputDir + slash + fullfileName, "-o", outFile, "-s", @@ -37,14 +40,14 @@ export const getSingleImageSharpenArguments = ( ) => { return [ "-i", - inputDir + "/" + fullfileName, + inputDir + slash + fullfileName, "-o", outFile, "-s", scale, "-x", "-m", - modelsPath + "/" + model, + modelsPath + slash + model, gpuId ? `-g ${gpuId}` : "", "-f", saveImageAs, @@ -63,7 +66,7 @@ export const getDoubleUpscaleArguments = ( ) => { return [ "-i", - inputDir + "/" + fullfileName, + inputDir + slash + fullfileName, "-o", outFile, "-s", @@ -149,7 +152,7 @@ export const getBatchSharpenArguments = ( scale, "-x", "-m", - modelsPath + "/" + model, + modelsPath + slash + model, gpuId ? `-g ${gpuId}` : "", "-f", saveImageAs,