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 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,

View File

@ -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,