Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .SRCINFO
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pkgbase = vortex-linux
source = 0041-linux-plugin-folder-prefix.patch
source = 0042-linux-wine-prefix-setting.patch
source = 0043-linux-steam-prefix-any-library.patch
source = 0045-linux-bg3-replacer-folder-case.patch
source = vortex.sh
source = vortex.desktop
source = README.md
Expand Down Expand Up @@ -158,6 +159,7 @@ pkgbase = vortex-linux
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2
sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632
sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b
Expand Down
2 changes: 2 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ _patches=(
'0041-linux-plugin-folder-prefix.patch'
'0042-linux-wine-prefix-setting.patch'
'0043-linux-steam-prefix-any-library.patch'
'0045-linux-bg3-replacer-folder-case.patch'
)

source=(
Expand Down Expand Up @@ -223,6 +224,7 @@ sha512sums=(
'SKIP'
'SKIP'
'SKIP'
'SKIP'
# Keep integrity checks for binaries downloaded outside this repository.
'935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2'
'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632'
Expand Down
101 changes: 101 additions & 0 deletions patches/0045-linux-bg3-replacer-folder-case.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
diff --git a/extensions/games/game-baldursgate3/src/installers.test.ts b/extensions/games/game-baldursgate3/src/installers.test.ts
new file mode 100644
--- /dev/null
+++ b/extensions/games/game-baldursgate3/src/installers.test.ts
@@ -0,0 +1,66 @@
+import * as path from "node:path";
+
+import { describe, expect, it, vi } from "vitest";
+
+import { installReplacer } from "./installers";
+
+// util pulls in the Vortex API, which only exists inside Vortex
+vi.mock("./util", () => ({ logDebug: () => undefined }));
+
+const join = (...segments: string[]) => segments.join(path.sep);
+
+describe("installReplacer", () => {
+ it("strips a wrapper folder above Generated whatever the case of its name", async () => {
+ // Upscaled Tattoos and Makeup (Nexus 1703) ships its textures this way
+ const tattoo = join("UpscaledTattoos_Makeup", "Generated", "Public", "Shared", "Tattoo.DDS");
+ const makeup = join("UpscaledTattoos_Makeup", "Generated", "Public", "Shared", "Makeup.dds");
+ // archives list every folder level as its own entry
+ const files = [
+ join("UpscaledTattoos_Makeup") + path.sep,
+ join("UpscaledTattoos_Makeup", "Generated") + path.sep,
+ join("UpscaledTattoos_Makeup", "Generated", "Public") + path.sep,
+ join("UpscaledTattoos_Makeup", "Generated", "Public", "Shared") + path.sep,
+ tattoo,
+ makeup,
+ ];
+
+ const result = await installReplacer(files);
+
+ expect(result.instructions).toEqual([
+ {
+ type: "copy",
+ source: tattoo,
+ destination: join("Generated", "Public", "Shared", "Tattoo.DDS"),
+ },
+ {
+ type: "copy",
+ source: makeup,
+ destination: join("Generated", "Public", "Shared", "Makeup.dds"),
+ },
+ ]);
+ });
+
+ it("strips the folders above a Data folder whatever their case", async () => {
+ const file = join("SomeMod", "Data", "English.loca");
+
+ const result = await installReplacer([file]);
+
+ expect(result.instructions).toEqual([
+ { type: "copy", source: file, destination: "English.loca" },
+ ]);
+ });
+
+ it("keeps the layout of an archive that already starts at Generated", async () => {
+ const file = join("Generated", "Public", "Shared", "Tattoo.DDS");
+ const files = [
+ join("Generated") + path.sep,
+ join("Generated", "Public") + path.sep,
+ join("Generated", "Public", "Shared") + path.sep,
+ file,
+ ];
+
+ const result = await installReplacer(files);
+
+ expect(result.instructions).toEqual([{ type: "copy", source: file, destination: file }]);
+ });
+});
diff --git a/extensions/games/game-baldursgate3/src/installers.ts b/extensions/games/game-baldursgate3/src/installers.ts
--- a/extensions/games/game-baldursgate3/src/installers.ts
+++ b/extensions/games/game-baldursgate3/src/installers.ts
@@ -235,17 +235,21 @@ export function testReplacer(files: string[], gameId: string): Promise<types.ISu
});
}

+function isNamed(dir: string, names: string[]): boolean {
+ return names.includes(path.basename(dir).toUpperCase());
+}
+
export async function installReplacer(files: string[]): Promise<types.IInstallResult> {
- const directories = Array.from(new Set(files.map((file) => path.dirname(file).toUpperCase())));
+ // Match folder names without case but keep the archive's spelling: files are
+ // made relative to dataPath below, and paths are case-sensitive on Linux.
+ const directories = Array.from(new Set(files.map((file) => path.dirname(file))));
let dataPath = undefined;
- const genOrPublic = directories.find((dir) =>
- ["PUBLIC", "GENERATED"].includes(path.basename(dir)),
- );
+ const genOrPublic = directories.find((dir) => isNamed(dir, ["PUBLIC", "GENERATED"]));
if (genOrPublic !== undefined) {
dataPath = path.dirname(genOrPublic);
}
if (dataPath === undefined) {
- dataPath = directories.find((dir) => path.basename(dir) === "DATA");
+ dataPath = directories.find((dir) => isNamed(dir, ["DATA"]));
}

const instructions: types.IInstruction[] =