Added debug options in package folder for manager

This commit is contained in:
Pax1601 2024-01-04 11:05:47 +01:00
parent a512b0e405
commit 38027b6ff3
13 changed files with 58 additions and 18 deletions

View File

@ -7,7 +7,7 @@
__/ | | |
|___/ |_|
v{{OLYMPUS_VERSION_NUMBER}}
{{OLYMPUS_VERSION_NUMBER}}
==========================================
INSTALLATION INSTRUCTIONS
@ -20,7 +20,7 @@ INSTALLATION INSTRUCTIONS
b) If you installed DCS Olympus v1.0.3 using the archived version, remove it by deleting the "...<DCS Saved Games folder>\Mods\Services\Olympus" folder. Do this for every DCS instance you installed Olympus in.
Remember to delete any shortcuts you created. Don't worry, they will be created automatically again by the installation script provided in this package.
3) Extract all the contents of the DCS Olympus v{{OLYMPUS_VERSION_NUMBER}} archive in your "Saved Games" folder (NOTE: not your DCS Saved Games folder).
3) Extract all the contents of the DCS Olympus {{OLYMPUS_VERSION_NUMBER}} archive in your "Saved Games" folder (NOTE: not your DCS Saved Games folder).
NOTE: Unlike previous version of Olympus, it is no longer necessary to copy the archived files into each DCS instance folder.
3) Execute the "installer.bat" script by double-clicking on it. Wait for the installation script to complete. Installation may take a couple of minutes, after which the Manager will start automatically.

View File

@ -4,10 +4,18 @@
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"name": "Start",
"runtimeExecutable": "npm",
"runtimeArgs": [ "start" ]
},
{
"type": "node",
"request": "launch",
"name": "Debug from package",
"runtimeExecutable": "npm",
"runtimeArgs": [ "start" ],
"port": 9229
"preLaunchTask": "mirror-package",
"cwd": "${workspaceFolder}\\..\\package\\manager"
}
]
}

13
manager/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "mirror-package",
"type": "shell",
"command": "call ./scripts/mirror-package.bat",
"isBackground": true
}
]
}

View File

@ -367,7 +367,8 @@ class DCSInstance {
() => {
location.reload();
},
() => {
(err) => {
console.error(err)
showErrorPopup("An error has occurred while uninstalling the Olympus instance. Make sure Olympus and DCS are not running.", () => {
location.reload();
});

View File

@ -104,14 +104,16 @@ async function installMod(folder, name) {
/* Check if backup user-editable files exist. If true copy them over */
try {
if (fs.existsSync(path.join(__dirname, "..", "..", "DCS Olympus backups", name, "databases"))) {
console.log(__dirname)
console.log(path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "databases"));
if (fs.existsSync(path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "databases"))) {
console.log("Backup databases found, copying over");
fs.cpSync(path.join(__dirname, "..", "..", "DCS Olympus backups", name, "databases"), path.join(folder, "Mods", "Services", "Olympus", "databases"));
fs.cpSync(path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "databases"), path.join(folder, "Mods", "Services", "Olympus", "databases"));
}
if (fs.existsSync(path.join(__dirname, "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"))) {
if (fs.existsSync(path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"))) {
console.log("Backup mods.lua found, copying over");
fs.cpSync(path.join(__dirname, "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"), path.join(folder, "Mods", "Services", "Olympus", "scripts", "mods.lua"));
fs.cpSync(path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"), path.join(folder, "Mods", "Services", "Olympus", "scripts", "mods.lua"));
}
} catch (err) {
console.log(`Error installing mod in ${folder}: ${err}`)
@ -253,8 +255,8 @@ async function deleteMod(folder, name) {
var promise = new Promise((res, rej) => {
if (fs.existsSync(path.join(folder, "Mods", "Services", "Olympus"))) {
/* Make a copy of the user-editable files */
fs.cpSync(path.join(folder, "Mods", "Services", "Olympus", "databases"), path.join(__dirname, "..", "..", "DCS Olympus backups", name, "databases"));
fs.cpSync(path.join(folder, "Mods", "Services", "Olympus", "scripts", "mods.lua"), path.join(__dirname, "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"));
fs.cpSync(path.join(folder, "Mods", "Services", "Olympus", "databases"), path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "databases"));
fs.cpSync(path.join(folder, "Mods", "Services", "Olympus", "scripts", "mods.lua"), path.join(__dirname, "..", "..", "..", "DCS Olympus backups", name, "scripts", "mods.lua"));
/* Remove the mod folder */
fs.rmdir(path.join(folder, "Mods", "Services", "Olympus"), { recursive: true, force: true }, (err) => {

View File

@ -12,6 +12,7 @@ const AdmZip = require("adm-zip");
const { Octokit } = require('octokit');
const VERSION = "v2.0.0";
console.log(`Running in ${__dirname}`);
function checkVersion() {
/* Check if we are running the latest version */

View File

@ -44,7 +44,7 @@ class ResultPage extends ManagerPage {
this.applyStepFailure(".hook");
return Promise.reject(err);
}
).then(() => installMod(this.instance.folder)).then(
).then(() => installMod(this.instance.folder, this.instance.name)).then(
() => {
this.applyStepSuccess(".mod");
},

View File

@ -5,7 +5,7 @@
"main": "main.js",
"scripts": {
"start": "electron .",
"build-release": "call ./scripts/build-release.bat"
"build-release": "call ./scripts/build-release.bat"
},
"author": "",
"license": "ISC",
@ -22,5 +22,8 @@
"regedit": "^5.1.2",
"sha256": "^0.2.0",
"win-version-info": "^6.0.1"
},
"devDependencies": {
"nodemon": "^3.0.2"
}
}
}

View File

@ -0,0 +1,9 @@
echo D|xcopy /Y /S /E .\icons ..\package\manager\icons
echo D|xcopy /Y /S /E .\ejs ..\package\manager\ejs
echo D|xcopy /Y /S /E .\javascripts ..\package\manager\javascripts
echo D|xcopy /Y /S /E .\stylesheets ..\package\manager\stylesheets
echo F|xcopy /Y /I .\*.* ..\package\manager
cd ..
call node .\scripts\node\set_version_text.js

View File

@ -0,0 +1 @@
nodemon --watch . --exec "./scripts/copy-package"

View File

@ -26,6 +26,3 @@ cd ..
cd manager
call npm run build-release
cd ..
REM other version tags are changed after compilation only in the build folder and should not be committed
call node .\scripts\node\set_version_text.js

View File

@ -17,6 +17,9 @@ echo D|xcopy /Y /S /E .\scripts\lua\backend .\package\mod\scripts
REM copy the mod folder
echo D|xcopy /Y /S /E .\mod .\package\mod
REM copy the databases folder
echo D|xcopy /Y /S /E .\databases .\package\mod\databases
REM copy the backend dll
echo F|xcopy /Y /I .\build\backend\bin\*.dll .\package\mod\bin
@ -37,3 +40,5 @@ echo F|xcopy /Y .\notes.txt .\package\notes.txt
REM copy the dependencies
echo D|xcopy /Y /S /E .\dependencies .\package\dependencies
REM other version tags are changed after compilation only in the package folder and should not be committed
call node .\scripts\node\set_version_text.js

View File

@ -33,7 +33,7 @@ fs.readFile("./version.json", "utf8", (error, data) => {
const minor = arr[1];
const minorminor = arr[2];
throughDirectory("./build");
throughDirectory("./package");
files.forEach((file) => {
fs.readFile(file, 'utf8', function (err,data) {