Updated start command

This commit is contained in:
Feenix
2022-11-12 02:20:20 +05:30
parent b44207f344
commit 5f6649c938
5 changed files with 7 additions and 16 deletions

View File

@@ -10,12 +10,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.modelsPath = exports.execPath = void 0;
const path_1 = require("path");
const getPlatform_1 = require("./getPlatform");
const getPlatform_1 = __importDefault(require("./getPlatform"));
const electron_is_dev_1 = __importDefault(require("electron-is-dev"));
const electron_1 = require("electron");
const appRootDir = electron_1.app.getAppPath();
const binariesPath = electron_is_dev_1.default
? (0, path_1.join)(appRootDir, "resources", (0, getPlatform_1.getPlatform)(), "bin")
? (0, path_1.join)(appRootDir, "resources", (0, getPlatform_1.default)(), "bin")
: (0, path_1.join)((0, path_1.dirname)(appRootDir), "bin");
const execPath = (execName) => (0, path_1.resolve)((0, path_1.join)(binariesPath, `./upscayl-${execName}`));
exports.execPath = execPath;

View File

@@ -1,6 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPlatform = void 0;
const os_1 = require("os");
const getPlatform = () => {
switch ((0, os_1.platform)()) {
@@ -17,4 +16,4 @@ const getPlatform = () => {
return "win";
}
};
exports.getPlatform = getPlatform;
exports.default = getPlatform;

View File

@@ -18,7 +18,7 @@ const url_1 = require("url");
const child_process_1 = require("child_process");
const fs_1 = __importDefault(require("fs"));
const electron_updater_1 = require("electron-updater");
const getPlatform_1 = require("./getPlatform");
const getPlatform_1 = __importDefault(require("./getPlatform"));
const binaries_1 = require("./binaries");
// Packages
const electron_1 = require("electron");
@@ -107,7 +107,7 @@ electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __a
let inputDir = payload.imagePath.match(/(.*)[\/\\]/)[1] || "";
let outputDir = payload.outputPath;
// COPY IMAGE TO TMP FOLDER
const platform = (0, getPlatform_1.getPlatform)();
const platform = (0, getPlatform_1.default)();
const fullfileName = platform === "win"
? payload.imagePath.split("\\").slice(-1)[0]
: payload.imagePath.split("/").slice(-1)[0];
@@ -201,7 +201,7 @@ electron_1.ipcMain.on(commands_1.default.UPSCAYL, (event, payload) => __awaiter(
let inputDir = payload.imagePath.match(/(.*)[\/\\]/)[1] || "";
let outputDir = payload.outputPath;
// COPY IMAGE TO TMP FOLDER
const platform = (0, getPlatform_1.getPlatform)();
const platform = (0, getPlatform_1.default)();
const fullfileName = platform === "win"
? payload.imagePath.split("\\").slice(-1)[0]
: payload.imagePath.split("/").slice(-1)[0];

View File

@@ -2,14 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const binaries_1 = require("./binaries");
/**
*
* @param {*} inputFile
* @param {*} outFile
* @param {*} modelsPath
* @param {*} model
* @returns
*/
function upscaylImage(inputFile, outFile, modelsPath, model) {
// UPSCALE
let upscayl = (0, child_process_1.spawn)((0, binaries_1.execPath)("realesrgan"), ["-i", inputFile, "-o", outFile, "-s", "4", "-m", modelsPath, "-n", model], {

View File

@@ -32,7 +32,7 @@
"main": "main/index.js",
"scripts": {
"clean": "rimraf dist renderer/.next renderer/out",
"start": "electron .",
"start": "tsc && electron .",
"build": "next build renderer && next export renderer",
"tsc": "tsc",
"pack-app": "npm run build && electron-builder --dir",