mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-20 04:57:38 -04:00
revising console log code
This commit is contained in:
parent
27b211a0f1
commit
58aa948226
|
@ -5,113 +5,26 @@
|
|||
clearInstallLogs,
|
||||
} from "$lib/utils/file";
|
||||
|
||||
// function handleError(output) {
|
||||
// if (output.code === 0) {
|
||||
// return;
|
||||
// }
|
||||
// switch (output.code) {
|
||||
// case 4000:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `can't locate ELF in ISO's contents`,
|
||||
// description: "unable to determine the version of the game",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4001:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unsupported serial`,
|
||||
// description:
|
||||
// "ISO containing an unsupported game serial or version was provided",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4002:
|
||||
// case 4010:
|
||||
// case 4011:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unsupported game version`,
|
||||
// description:
|
||||
// "ISO contains files that are for an unsupported version, were modified from the original, or is an incomplete dump",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4020:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unexpected Extraction Result`,
|
||||
// description:
|
||||
// "The extracted ISO's contents were not as expected, installation cannot proceed",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// default:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unexpected Error Code ${output.code}`,
|
||||
// description:
|
||||
// "An unexpected error occurred during installation, check logs",
|
||||
// },
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
import { SUPPORTED_GAME } from "$lib/constants";
|
||||
|
||||
// async function appendLogs(output) {
|
||||
// const separator = `----${installSteps[currStep].text}----\n`;
|
||||
// await appendToInstallLog(
|
||||
// SupportedGame.Jak1,
|
||||
// "\n" + separator + output.stdout
|
||||
// );
|
||||
// await appendToInstallErrorLog(
|
||||
// SupportedGame.Jak1,
|
||||
// "\n" + separator + output.stderr
|
||||
// );
|
||||
// if (installSteps[currStep] != undefined) {
|
||||
// installSteps[currStep].logs += "\n" + separator + output.stdout;
|
||||
// installSteps[currStep].errorLogs += output.stderr;
|
||||
// }
|
||||
// }
|
||||
let installErrors;
|
||||
let installSteps = [];
|
||||
|
||||
// async function installProcess() {
|
||||
// await clearInstallLogs(SupportedGame.Jak1);
|
||||
// // Reset experience
|
||||
// installErrors = [];
|
||||
// for (let i = 0; i < installSteps.length; i++) {
|
||||
// installSteps[i].logs = "";
|
||||
// installSteps[i].errorLogs = "";
|
||||
// installSteps[i].status = InstallationStatus.Pending;
|
||||
// }
|
||||
// currStep = 0;
|
||||
// setupStarted = true;
|
||||
// setupInProgress = true;
|
||||
// installSteps[currStep].status = InstallationStatus.InProgress;
|
||||
// let output = await extractAndValidateISO(isoPath);
|
||||
// finishStep(output);
|
||||
// if (output.code === 0) {
|
||||
// console.log("[OpenGOAL]: Extraction and Validation Completed");
|
||||
// output = await decompileGameData(isoPath);
|
||||
// finishStep(output);
|
||||
// }
|
||||
// if (output.code === 0) {
|
||||
// console.log("[OpenGOAL]: Decompilation Completed");
|
||||
// output = await compileGame(isoPath);
|
||||
// finishStep(output);
|
||||
// }
|
||||
// if (output.code === 0) {
|
||||
// console.log("[OpenGOAL]: Compilation Completed");
|
||||
// await setInstallStatus(SupportedGame.Jak1, true);
|
||||
// navigate("/jak1", { replace: true });
|
||||
// }
|
||||
// setupInProgress = false;
|
||||
// isoPath = undefined;
|
||||
// }
|
||||
async function appendLogs(output) {
|
||||
// const separator = `----${installSteps[currStep].text}----\n`;
|
||||
// await appendToInstallLog(
|
||||
// SUPPORTED_GAME.Jak1,
|
||||
// "\n" + separator + output.stdout
|
||||
// );
|
||||
// await appendToInstallErrorLog(
|
||||
// SUPPORTED_GAME.Jak1,
|
||||
// "\n" + separator + output.stderr
|
||||
// );
|
||||
// if (installSteps[currStep] != undefined) {
|
||||
// installSteps[currStep].logs += "\n" + separator + output.stdout;
|
||||
// installSteps[currStep].errorLogs += output.stderr;
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="row">
|
||||
|
|
|
@ -1,5 +1,63 @@
|
|||
<script>
|
||||
export let errorMsg;
|
||||
|
||||
// function handleError(output) {
|
||||
// if (output.code === 0) {
|
||||
// return;
|
||||
// }
|
||||
// switch (output.code) {
|
||||
// case 4000:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `can't locate ELF in ISO's contents`,
|
||||
// description: "unable to determine the version of the game",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4001:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unsupported serial`,
|
||||
// description:
|
||||
// "ISO containing an unsupported game serial or version was provided",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4002:
|
||||
// case 4010:
|
||||
// case 4011:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unsupported game version`,
|
||||
// description:
|
||||
// "ISO contains files that are for an unsupported version, were modified from the original, or is an incomplete dump",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// case 4020:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unexpected Extraction Result`,
|
||||
// description:
|
||||
// "The extracted ISO's contents were not as expected, installation cannot proceed",
|
||||
// },
|
||||
// ];
|
||||
// break;
|
||||
// default:
|
||||
// installErrors = [
|
||||
// ...installErrors,
|
||||
// {
|
||||
// title: `Unexpected Error Code ${output.code}`,
|
||||
// description:
|
||||
// "An unexpected error occurred during installation, check logs",
|
||||
// },
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
|
||||
<section>
|
||||
|
|
|
@ -27,12 +27,12 @@ export async function filePrompt() {
|
|||
|
||||
export async function clearInstallLogs(supportedGame, text) {
|
||||
const dir = await logDir();
|
||||
let fileName = `${supportedGame.name}-install.log`;
|
||||
let fileName = `${supportedGame}-install.log`;
|
||||
let fullPath = await join(dir, fileName);
|
||||
if (await fileExists(fullPath)) {
|
||||
await writeFile({ contents: "", path: fullPath });
|
||||
}
|
||||
fileName = `${supportedGame.name}-install-errors.log`;
|
||||
fileName = `${supportedGame}-install-errors.log`;
|
||||
fullPath = await join(dir, fileName);
|
||||
if (await fileExists(fullPath)) {
|
||||
await writeFile({ contents: "", path: fullPath });
|
||||
|
@ -41,7 +41,7 @@ export async function clearInstallLogs(supportedGame, text) {
|
|||
|
||||
export async function appendToInstallLog(supportedGame, text) {
|
||||
const dir = await logDir();
|
||||
const fileName = `${supportedGame.name}-install.log`;
|
||||
const fileName = `${supportedGame}-install.log`;
|
||||
const fullPath = await join(dir, fileName);
|
||||
console.log(`[OG]: Writing logs to ${fullPath}`);
|
||||
let contents = "";
|
||||
|
@ -56,7 +56,7 @@ export async function appendToInstallLog(supportedGame, text) {
|
|||
|
||||
export async function appendToInstallErrorLog(supportedGame, text) {
|
||||
const dir = await logDir();
|
||||
const fileName = `${supportedGame.name}-install-errors.log`;
|
||||
const fileName = `${supportedGame}-install-errors.log`;
|
||||
const fullPath = await join(dir, fileName);
|
||||
console.log(`[OG]: Writing logs to ${fullPath}`);
|
||||
let contents = "";
|
||||
|
|
Loading…
Reference in a new issue