From 757c4506f55d3415f322948fece0f0dfa7c9b583 Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Mon, 25 Mar 2024 08:30:41 +0000 Subject: [PATCH] Fix loading bundles from different local folders (!270) Return a full path to the request for getBundles if running locally Ran into this while working on updating Gilded Key Storage, looks like bundle files are expected to live in the same local folder as the client any time the server address is `127.0.0.1` or `localhost`. While working in VSCode for the server, and a different folder for the client, this causes issues trying to work on mods that add bundles, as the server only passes a relative path back to the client This PR resolves that by returning the full path to bundles when running locally Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/270 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- project/src/loaders/BundleLoader.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/src/loaders/BundleLoader.ts b/project/src/loaders/BundleLoader.ts index 7e9f347a..1a7be5a2 100644 --- a/project/src/loaders/BundleLoader.ts +++ b/project/src/loaders/BundleLoader.ts @@ -1,5 +1,6 @@ import { inject, injectable } from "tsyringe"; +import path from "path"; import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { VFS } from "@spt-aki/utils/VFS"; @@ -55,7 +56,7 @@ export class BundleLoader if (local) { - bundle.path = bundle.filepath; + bundle.path = path.join(process.cwd(), bundle.filepath); } delete bundle.filepath;