1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 01:10:52 +01:00

Merge pull request #291 from aaronliu0130/winPathFix

This commit is contained in:
Aaron Liu 2023-04-29 12:26:50 -04:00 committed by GitHub
commit 24a8ec211f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View File

@ -45,6 +45,9 @@ let customModelsFolderPath: string | undefined = undefined;
let outputFolderPath: string | undefined = undefined; let outputFolderPath: string | undefined = undefined;
let saveOutputFolder = false; let saveOutputFolder = false;
// Slashes for use in directory names
const slash: string = getPlatform() === "win" ? "\\" : "/";
// Prepare the renderer once the app is ready // Prepare the renderer once the app is ready
let mainWindow: BrowserWindow; let mainWindow: BrowserWindow;
app.on("ready", async () => { app.on("ready", async () => {
@ -338,15 +341,11 @@ ipcMain.on(commands.DOUBLE_UPSCAYL, async (event, payload) => {
const isDefaultModel = defaultModels.includes(model); const isDefaultModel = defaultModels.includes(model);
// COPY IMAGE TO TMP FOLDER // COPY IMAGE TO TMP FOLDER
const platform = getPlatform();
const fullfileName = const fullfileName = (payload.imagePath.split(slash).slice(-1)[0] as string);
platform === "win"
? (payload.imagePath.split("\\").slice(-1)[0] as string)
: (payload.imagePath.split("/").slice(-1)[0] as string);
const fileName = parse(fullfileName).name; const fileName = parse(fullfileName).name;
const fileExt = parse(fullfileName).ext;
const outFile = const outFile =
outputDir + "/" + fileName + "_upscayl_16x_" + model + "." + saveImageAs; outputDir + slash + fileName + "_upscayl_16x_" + model + "." + saveImageAs;
// UPSCALE // UPSCALE
let upscayl = spawnUpscayl( let upscayl = spawnUpscayl(
@ -474,7 +473,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
const outFile = const outFile =
outputDir + outputDir +
"/" + slash +
fileName + fileName +
"_upscayl_" + "_upscayl_" +
scale + scale +
@ -680,8 +679,8 @@ autoUpdater.on("update-downloaded", (event) => {
// ffmpeg.path, // ffmpeg.path,
// [ // [
// "-i", // "-i",
// inputDir + "/" + videoFileName, // inputDir + slash + videoFileName,
// frameExtractionPath + "/" + "out%d.png", // frameExtractionPath + slash + "out%d.png",
// ], // ],
// { // {
// cwd: undefined, // cwd: undefined,

View File

@ -1,3 +1,6 @@
import getPlatform from "../getPlatform";
const slash: string = getPlatform() === "win" ? "\\" : "/";
export const getSingleImageArguments = ( export const getSingleImageArguments = (
inputDir: string, inputDir: string,
fullfileName: string, fullfileName: string,
@ -10,7 +13,7 @@ export const getSingleImageArguments = (
) => { ) => {
return [ return [
"-i", "-i",
inputDir + "/" + fullfileName, inputDir + slash + fullfileName,
"-o", "-o",
outFile, outFile,
"-s", "-s",
@ -37,14 +40,14 @@ export const getSingleImageSharpenArguments = (
) => { ) => {
return [ return [
"-i", "-i",
inputDir + "/" + fullfileName, inputDir + slash + fullfileName,
"-o", "-o",
outFile, outFile,
"-s", "-s",
scale, scale,
"-x", "-x",
"-m", "-m",
modelsPath + "/" + model, modelsPath + slash + model,
gpuId ? `-g ${gpuId}` : "", gpuId ? `-g ${gpuId}` : "",
"-f", "-f",
saveImageAs, saveImageAs,
@ -63,7 +66,7 @@ export const getDoubleUpscaleArguments = (
) => { ) => {
return [ return [
"-i", "-i",
inputDir + "/" + fullfileName, inputDir + slash + fullfileName,
"-o", "-o",
outFile, outFile,
"-s", "-s",
@ -149,7 +152,7 @@ export const getBatchSharpenArguments = (
scale, scale,
"-x", "-x",
"-m", "-m",
modelsPath + "/" + model, modelsPath + slash + model,
gpuId ? `-g ${gpuId}` : "", gpuId ? `-g ${gpuId}` : "",
"-f", "-f",
saveImageAs, saveImageAs,