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,
|
clearInstallLogs,
|
||||||
} from "$lib/utils/file";
|
} from "$lib/utils/file";
|
||||||
|
|
||||||
// function handleError(output) {
|
import { SUPPORTED_GAME } from "$lib/constants";
|
||||||
// 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",
|
|
||||||
// },
|
|
||||||
// ];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function appendLogs(output) {
|
let installErrors;
|
||||||
// const separator = `----${installSteps[currStep].text}----\n`;
|
let installSteps = [];
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function installProcess() {
|
async function appendLogs(output) {
|
||||||
// await clearInstallLogs(SupportedGame.Jak1);
|
// const separator = `----${installSteps[currStep].text}----\n`;
|
||||||
// // Reset experience
|
// await appendToInstallLog(
|
||||||
// installErrors = [];
|
// SUPPORTED_GAME.Jak1,
|
||||||
// for (let i = 0; i < installSteps.length; i++) {
|
// "\n" + separator + output.stdout
|
||||||
// installSteps[i].logs = "";
|
// );
|
||||||
// installSteps[i].errorLogs = "";
|
// await appendToInstallErrorLog(
|
||||||
// installSteps[i].status = InstallationStatus.Pending;
|
// SUPPORTED_GAME.Jak1,
|
||||||
// }
|
// "\n" + separator + output.stderr
|
||||||
// currStep = 0;
|
// );
|
||||||
// setupStarted = true;
|
// if (installSteps[currStep] != undefined) {
|
||||||
// setupInProgress = true;
|
// installSteps[currStep].logs += "\n" + separator + output.stdout;
|
||||||
// installSteps[currStep].status = InstallationStatus.InProgress;
|
// installSteps[currStep].errorLogs += output.stderr;
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -1,5 +1,63 @@
|
||||||
<script>
|
<script>
|
||||||
export let errorMsg;
|
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>
|
</script>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -27,12 +27,12 @@ export async function filePrompt() {
|
||||||
|
|
||||||
export async function clearInstallLogs(supportedGame, text) {
|
export async function clearInstallLogs(supportedGame, text) {
|
||||||
const dir = await logDir();
|
const dir = await logDir();
|
||||||
let fileName = `${supportedGame.name}-install.log`;
|
let fileName = `${supportedGame}-install.log`;
|
||||||
let fullPath = await join(dir, fileName);
|
let fullPath = await join(dir, fileName);
|
||||||
if (await fileExists(fullPath)) {
|
if (await fileExists(fullPath)) {
|
||||||
await writeFile({ contents: "", path: fullPath });
|
await writeFile({ contents: "", path: fullPath });
|
||||||
}
|
}
|
||||||
fileName = `${supportedGame.name}-install-errors.log`;
|
fileName = `${supportedGame}-install-errors.log`;
|
||||||
fullPath = await join(dir, fileName);
|
fullPath = await join(dir, fileName);
|
||||||
if (await fileExists(fullPath)) {
|
if (await fileExists(fullPath)) {
|
||||||
await writeFile({ contents: "", path: fullPath });
|
await writeFile({ contents: "", path: fullPath });
|
||||||
|
@ -41,7 +41,7 @@ export async function clearInstallLogs(supportedGame, text) {
|
||||||
|
|
||||||
export async function appendToInstallLog(supportedGame, text) {
|
export async function appendToInstallLog(supportedGame, text) {
|
||||||
const dir = await logDir();
|
const dir = await logDir();
|
||||||
const fileName = `${supportedGame.name}-install.log`;
|
const fileName = `${supportedGame}-install.log`;
|
||||||
const fullPath = await join(dir, fileName);
|
const fullPath = await join(dir, fileName);
|
||||||
console.log(`[OG]: Writing logs to ${fullPath}`);
|
console.log(`[OG]: Writing logs to ${fullPath}`);
|
||||||
let contents = "";
|
let contents = "";
|
||||||
|
@ -56,7 +56,7 @@ export async function appendToInstallLog(supportedGame, text) {
|
||||||
|
|
||||||
export async function appendToInstallErrorLog(supportedGame, text) {
|
export async function appendToInstallErrorLog(supportedGame, text) {
|
||||||
const dir = await logDir();
|
const dir = await logDir();
|
||||||
const fileName = `${supportedGame.name}-install-errors.log`;
|
const fileName = `${supportedGame}-install-errors.log`;
|
||||||
const fullPath = await join(dir, fileName);
|
const fullPath = await join(dir, fileName);
|
||||||
console.log(`[OG]: Writing logs to ${fullPath}`);
|
console.log(`[OG]: Writing logs to ${fullPath}`);
|
||||||
let contents = "";
|
let contents = "";
|
||||||
|
|
Loading…
Reference in a new issue