From 09b99bf78c0535c9d1d1880f6f4b0f21aa22b24b Mon Sep 17 00:00:00 2001 From: Yagz <4955479+Yagz@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:51:19 +0100 Subject: [PATCH 1/8] Check the Proton prefix's drive for hardlink deployment Mods for a Windows user folder are deployed into the game's prefix, but the hardlink and move checks compared the staging drive with the Linux path in the home folder. --- .SRCINFO | 2 + CHANGELOG.md | 5 + PKGBUILD | 2 + .../0044-linux-prefix-deployment-drive.patch | 366 ++++++++++++++++++ 4 files changed, 375 insertions(+) create mode 100644 patches/0044-linux-prefix-deployment-drive.patch diff --git a/.SRCINFO b/.SRCINFO index 2387202..3a93469 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -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 = 0044-linux-prefix-deployment-drive.patch source = vortex.sh source = vortex.desktop source = README.md @@ -158,6 +159,7 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP + sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b30810..0d83d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ publishes a new Vortex version, taking any pending notes with it. ## Unreleased +- Hardlink and move deployment no longer refuse games that put their mods in + the Proton prefix, such as Baldur's Gate 3, when the staging folder is on the + same drive as the prefix. The suggested staging folder is on that drive too. + (#37) + ## 2.11.0-1 - 2026-11-19 - Update to Vortex 2.11.0 and use its Linux dashboard disk-space support. diff --git a/PKGBUILD b/PKGBUILD index a6e3e7d..e5241a9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -144,6 +144,7 @@ _patches=( '0041-linux-plugin-folder-prefix.patch' '0042-linux-wine-prefix-setting.patch' '0043-linux-steam-prefix-any-library.patch' + '0044-linux-prefix-deployment-drive.patch' ) source=( @@ -223,6 +224,7 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' + 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0044-linux-prefix-deployment-drive.patch b/patches/0044-linux-prefix-deployment-drive.patch new file mode 100644 index 0000000..64d8596 --- /dev/null +++ b/patches/0044-linux-prefix-deployment-drive.patch @@ -0,0 +1,366 @@ +diff --git a/src/renderer/src/extensions/gamemode_management/util/discovery.ts b/src/renderer/src/extensions/gamemode_management/util/discovery.ts +--- a/src/renderer/src/extensions/gamemode_management/util/discovery.ts ++++ b/src/renderer/src/extensions/gamemode_management/util/discovery.ts +@@ -22,6 +22,7 @@ import type { Normalize } from "../../../util/getNormalizeFunc"; + import getNormalizeFunc from "../../../util/getNormalizeFunc"; + import { getVolumePath } from "../../../util/getVolumePath"; + import getVortexPath from "../../../util/getVortexPath"; ++import { resolveCaseInsensitiveSync } from "../../../util/linuxCompatibility"; + import { resolveNativeExecutable, resolvePlatformPath } from "../../../util/nativeExecutable"; + import StarterInfo from "../../../util/StarterInfo"; + import { getSafe } from "../../../util/storeHelper"; +@@ -756,7 +757,10 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr + } + }; + +- await idModPath(modPaths[""]); ++ // On Linux, a mod path below a Windows user folder is deployed into the ++ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. ++ const modPath = resolveCaseInsensitiveSync(modPaths[""]); ++ await idModPath(modPath); + const statUserData = await fs.statAsync(getVortexPath("userData")); + + let suggestion: string; +@@ -766,7 +770,7 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr + suggestion = path.join("{USERDATA}", "{game}", "mods"); + } else { + // different drives, suggest path on same drive +- const volume = getVolumePath(modPaths[""]); ++ const volume = getVolumePath(modPath); + suggestion = path.join(volume, state.settings.mods.suggestInstallPathDirectory, "{game}"); + } + +diff --git a/src/renderer/src/extensions/hardlink_activator/index.ts b/src/renderer/src/extensions/hardlink_activator/index.ts +--- a/src/renderer/src/extensions/hardlink_activator/index.ts ++++ b/src/renderer/src/extensions/hardlink_activator/index.ts +@@ -13,6 +13,7 @@ import type { IGame } from "../../types/IGame"; + import type { IState } from "../../types/IState"; + import * as fs from "../../util/fs"; + import { getVolumePath } from "../../util/getVolumePath"; ++import { resolveCaseInsensitiveSync } from "../../util/linuxCompatibility"; + import { installPathForGame } from "../../util/selectors"; + import { assertPathWritable, getPathDevice } from "../../util/volume"; + import type { IDiscoveryResult } from "../gamemode_management/types/IDiscoveryResult"; +@@ -86,15 +87,29 @@ class DeploymentMethod extends LinkingDeployment { + return undefined; + } + ++ const installationPath = installPathForGame(state, gameId); ++ ++ // On Linux, a mod path below a Windows user folder (AppData, Documents, ...) ++ // is deployed into the game's Wine/Proton prefix, not into the Linux folder ++ // the game extension names. Check the folders deployment actually uses. ++ let modPath: string; ++ let stagingPath: string; ++ try { ++ modPath = resolveCaseInsensitiveSync(modPaths[typeId]); ++ stagingPath = resolveCaseInsensitiveSync(installationPath); ++ } catch (err) { ++ return { description: () => getErrorMessageOrDefault(err) }; ++ } ++ + try { + // A deployment path may legitimately not exist until the first file is + // deployed. In that case its nearest existing parent determines whether + // Vortex can create it. +- assertPathWritable(modPaths[typeId]); ++ assertPathWritable(modPath); + } catch { + log("info", "hardlink deployment not supported due to lack of write access", { + typeId, +- path: modPaths[typeId], ++ path: modPath, + }); + return { + description: (t) => t("Can't write to output directory."), +@@ -105,28 +120,26 @@ class DeploymentMethod extends LinkingDeployment { + 'write permission to "{{modPath}}".', + { + replace: { +- modPath: modPaths[typeId], ++ modPath, + }, + }, + ), + }; + } + +- const installationPath = installPathForGame(state, gameId); +- + try { +- if (getPathDevice(installationPath) !== getPathDevice(modPaths[typeId])) { ++ if (getPathDevice(stagingPath) !== getPathDevice(modPath)) { + // hard links work only on the same drive + return { + description: (t) => t("Works only if mods are installed on the same drive as the game."), + order: 5, + solution: (t) => { +- let displayPath = modPaths[typeId]; ++ let displayPath = modPath; + try { +- displayPath = getVolumePath(modPaths[typeId]); ++ displayPath = getVolumePath(modPath); + } catch { + log("warn", "Failed to resolve volume path", { +- path: modPaths[typeId], ++ path: modPath, + }); + } + return t( +@@ -158,7 +171,7 @@ class DeploymentMethod extends LinkingDeployment { + // this can happen when managing the the game for the first time + log("info", "failed to stat. directory missing?", { + dir1: installationPath || "undefined", +- dir2: modPaths[typeId], ++ dir2: modPath, + err: util.inspect(err), + }); + return { +diff --git a/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts +new file mode 100644 +--- /dev/null ++++ b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts +@@ -0,0 +1,129 @@ ++import * as fs from "node:fs"; ++import * as os from "node:os"; ++import * as path from "node:path"; ++ ++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; ++ ++import { makeRealDeploymentMethod } from "../../test-utils/builders"; ++import { ++ resetCompatibilityPathCache, ++ setCompatibilityGameProvider, ++} from "../../util/compatibilityPaths"; ++import type * as selectors from "../../util/selectors"; ++import type * as volume from "../../util/volume"; ++import type * as modSelectors from "../mod_management/selectors"; ++import moveInit from "../move_activator"; ++import hardlinkInit from "./index"; ++ ++// Real devices can't be created in a test: every path below one of these roots ++// counts as the staging folder's drive, anything else as another drive. ++const fixture = vi.hoisted(() => ({ ++ stagingDrive: [] as string[], ++ staging: "", ++ modPaths: {} as Record, ++})); ++ ++vi.mock("../../util/volume", async (original) => { ++ const actual = await original(); ++ const nodePath = await import("node:path"); ++ return { ++ ...actual, ++ getPathDevice: (input: string) => ++ fixture.stagingDrive.some((root) => input === root || input.startsWith(root + nodePath.sep)) ++ ? 1 ++ : 2, ++ }; ++}); ++ ++vi.mock("../gamemode_management/util/getGame", () => ({ ++ getGame: () => ({ id: "baldursgate3", getModPaths: () => fixture.modPaths }), ++})); ++ ++vi.mock("../../util/selectors", async (original) => ({ ++ ...(await original()), ++ installPathForGame: () => fixture.staging, ++})); ++ ++vi.mock("../mod_management/selectors", async (original) => ({ ++ ...(await original()), ++ installPathForGame: () => fixture.staging, ++})); ++ ++const identity = (input: string) => input; ++const GAME = "baldursgate3"; ++ ++describe.runIf(process.platform === "linux")( ++ "deployment methods on a mod path inside the game's prefix", ++ () => { ++ let home: string; ++ let prefix: string; ++ let gameDir: string; ++ let linuxModPath: string; ++ let state: any; ++ ++ beforeEach(() => { ++ home = fs.mkdtempSync(path.join(os.tmpdir(), "vortex-prefix-target-")); ++ prefix = path.join(home, "steamapps/compatdata/1086940/pfx"); ++ gameDir = path.join(home, "steamapps/common/Baldurs Gate 3"); ++ fixture.staging = path.join(home, "staging/baldursgate3"); ++ // what the game extension asks for: AppData\Local as Vortex maps it on Linux ++ linuxModPath = path.join(home, "Local/Larian Studios/Baldur's Gate 3/Mods"); ++ fixture.modPaths = { "": linuxModPath }; ++ ++ // the game ran once through Proton, so its profile folder exists in the prefix ++ fs.mkdirSync( ++ path.join(prefix, "drive_c/users/steamuser/AppData/Local/Larian Studios/Baldur's Gate 3"), ++ { recursive: true }, ++ ); ++ fs.mkdirSync(gameDir, { recursive: true }); ++ fs.mkdirSync(fixture.staging, { recursive: true }); ++ // the staging folder, the game and the prefix share one drive; home is another ++ fixture.stagingDrive = [path.join(home, "staging"), path.join(home, "steamapps")]; ++ ++ vi.stubEnv("VORTEX_LINUX_APPDATA", path.join(home, ".config")); ++ vi.stubEnv("VORTEX_LINUX_LOCAL_APPDATA", path.join(home, "Local")); ++ vi.stubEnv("VORTEX_LINUX_DOCUMENTS", path.join(home, "Documents")); ++ vi.stubEnv("VORTEX_COMPAT_PREFIXES", ""); ++ setCompatibilityGameProvider(() => ({ path: gameDir, environment: { WINEPREFIX: prefix } })); ++ ++ state = { settings: { gameMode: { discovered: { [GAME]: { path: gameDir } } } } }; ++ }); ++ ++ afterEach(() => { ++ setCompatibilityGameProvider(undefined); ++ resetCompatibilityPathCache(); ++ vi.unstubAllEnvs(); ++ fs.rmSync(home, { force: true, recursive: true }); ++ }); ++ ++ it.each([ ++ ["hardlink", hardlinkInit], ++ ["move", moveInit], ++ ])("%s deployment compares the staging drive with the prefix", (_name, init) => { ++ const method = makeRealDeploymentMethod({} as any, init); ++ ++ expect(method.isSupported(state, GAME, "")).toBeUndefined(); ++ }); ++ ++ it("still refuses hardlinks when the prefix is on another drive than staging", () => { ++ fixture.stagingDrive = [path.join(home, "staging")]; ++ const method = makeRealDeploymentMethod({} as any, hardlinkInit); ++ ++ const reason = method.isSupported(state, GAME, ""); ++ ++ expect(reason?.description(identity as any)).toMatch(/same drive/); ++ }); ++ ++ it("reports a missing prefix instead of a write permission problem", () => { ++ setCompatibilityGameProvider(() => ({ ++ path: gameDir, ++ environment: { WINEPREFIX: path.join(home, "missing") }, ++ })); ++ const method = makeRealDeploymentMethod({} as any, hardlinkInit); ++ ++ const reason = method.isSupported(state, GAME, ""); ++ ++ expect(reason?.description(identity as any)).toMatch(/unavailable/); ++ }); ++ }, ++); +diff --git a/src/renderer/src/extensions/mod_management/views/Settings.tsx b/src/renderer/src/extensions/mod_management/views/Settings.tsx +--- a/src/renderer/src/extensions/mod_management/views/Settings.tsx ++++ b/src/renderer/src/extensions/mod_management/views/Settings.tsx +@@ -49,6 +49,7 @@ import * as fs from "../../../util/fs"; + import getNormalizeFunc from "../../../util/getNormalizeFunc"; + import { getVolumePath } from "../../../util/getVolumePath"; + import getVortexPath from "../../../util/getVortexPath"; ++import { resolveCaseInsensitiveSync } from "../../../util/linuxCompatibility"; + import { log } from "../../../util/log"; + import { showError } from "../../../util/message"; + import opn from "../../../util/opn"; +@@ -1054,7 +1055,9 @@ class Settings extends ComponentEx { + try { + // stat the volume root rather than the full mod path — the mod directory + // may not exist yet (e.g. first-time setup), but we only need the device id +- const volume = getVolumePath(modPaths[""]); ++ // On Linux, a mod path below a Windows user folder is deployed into the ++ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. ++ const volume = getVolumePath(resolveCaseInsensitiveSync(modPaths[""])); + const [modPathStats, userDataStats] = await Promise.all([ + fs.statAsync(volume), + window.api.app.getPath("userData").then((userDataPath) => fs.statAsync(userDataPath)), +diff --git a/src/renderer/src/extensions/move_activator/index.ts b/src/renderer/src/extensions/move_activator/index.ts +--- a/src/renderer/src/extensions/move_activator/index.ts ++++ b/src/renderer/src/extensions/move_activator/index.ts +@@ -1,6 +1,7 @@ + import * as path from "path"; + import * as util from "util"; + ++import { getErrorMessageOrDefault } from "@vortex/shared"; + import PromiseBB from "bluebird"; + import type { TFunction } from "i18next"; + import type { IEntry } from "turbowalk"; +@@ -12,6 +13,7 @@ import type { IGame } from "../../types/IGame"; + import { UserCanceled } from "../../util/CustomErrors"; + import * as fs from "../../util/fs"; + import { getVolumePath } from "../../util/getVolumePath"; ++import { resolveCaseInsensitiveSync } from "../../util/linuxCompatibility"; + import { log } from "../../util/log"; + import { assertPathWritable, getPathDevice } from "../../util/volume"; + import type { IDiscoveryResult } from "../gamemode_management/types/IDiscoveryResult"; +@@ -90,14 +92,28 @@ class DeploymentMethod extends LinkingDeployment { + }; + } + ++ // On Linux, a mod path below a Windows user folder (AppData, Documents, ...) ++ // is deployed into the game's Wine/Proton prefix, not into the Linux folder ++ // the game extension names. Check the folders deployment actually uses. ++ let modPath: string = modPaths[typeId]; ++ let stagingPath: string; ++ try { ++ if (modPath !== undefined) { ++ modPath = resolveCaseInsensitiveSync(modPath); ++ } ++ stagingPath = resolveCaseInsensitiveSync(instPath); ++ } catch (err) { ++ return { description: () => getErrorMessageOrDefault(err) }; ++ } ++ + try { + // The output directory is commonly created during the first deployment. + // Its existing parent is the relevant permission boundary until then. +- assertPathWritable(modPaths[typeId]); ++ assertPathWritable(modPath); + } catch (err) { + log("info", "move deployment not supported due to lack of write access", { + typeId, +- path: modPaths[typeId], ++ path: modPath, + }); + return { + description: (t) => t("Can't write to output directory"), +@@ -108,7 +124,7 @@ class DeploymentMethod extends LinkingDeployment { + 'be given write permission to "{{modPath}}".', + { + replace: { +- modPath: modPaths[typeId], ++ modPath, + }, + }, + ), +@@ -116,19 +132,19 @@ class DeploymentMethod extends LinkingDeployment { + } + + try { +- if (getPathDevice(instPath) !== getPathDevice(modPaths[typeId])) { ++ if (getPathDevice(stagingPath) !== getPathDevice(modPath)) { + // actually we could support this but it would be so slow it wouldn't make sense + + return { + description: (t) => t("Works only if mods are installed on the same drive as the game"), + order: 8, + solution: (t) => { +- let displayPath = modPaths[typeId]; ++ let displayPath = modPath; + try { +- displayPath = getVolumePath(modPaths[typeId]); ++ displayPath = getVolumePath(modPath); + } catch (err) { + log("warn", "Failed to resolve volume path", { +- path: modPaths[typeId], ++ path: modPath, + }); + } + return t( +@@ -160,7 +176,7 @@ class DeploymentMethod extends LinkingDeployment { + // this can happen when managing the the game for the first time + log("info", "failed to stat. directory missing?", { + dir1: instPath || "undefined", +- dir2: modPaths[typeId], ++ dir2: modPath, + err: util.inspect(err), + }); + return { From accf2f4efa0e194f713fdbce50aa19e1c80b6b86 Mon Sep 17 00:00:00 2001 From: Yagz <4955479+Yagz@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:51:19 +0100 Subject: [PATCH 2/8] Keep folder case in the BG3 replacer installer It upper-cased folder names and then made paths relative to them, so on Linux every file of a mod with a wrapper folder was dropped. --- .SRCINFO | 2 + CHANGELOG.md | 3 + PKGBUILD | 2 + .../0045-linux-bg3-replacer-folder-case.patch | 101 ++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 patches/0045-linux-bg3-replacer-folder-case.patch diff --git a/.SRCINFO b/.SRCINFO index 3a93469..5535ab4 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -101,6 +101,7 @@ pkgbase = vortex-linux source = 0042-linux-wine-prefix-setting.patch source = 0043-linux-steam-prefix-any-library.patch source = 0044-linux-prefix-deployment-drive.patch + source = 0045-linux-bg3-replacer-folder-case.patch source = vortex.sh source = vortex.desktop source = README.md @@ -160,6 +161,7 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP + sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d83d78..f5558de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ publishes a new Vortex version, taking any pending notes with it. the Proton prefix, such as Baldur's Gate 3, when the staging folder is on the same drive as the prefix. The suggested staging folder is on that drive too. (#37) +- Baldur's Gate 3 mods that keep their Generated, Public or Data folder inside + another folder, such as Upscaled Tattoos and Makeup, no longer end with + "Installation canceled". (#38) ## 2.11.0-1 - 2026-11-19 diff --git a/PKGBUILD b/PKGBUILD index e5241a9..9a3446a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -145,6 +145,7 @@ _patches=( '0042-linux-wine-prefix-setting.patch' '0043-linux-steam-prefix-any-library.patch' '0044-linux-prefix-deployment-drive.patch' + '0045-linux-bg3-replacer-folder-case.patch' ) source=( @@ -225,6 +226,7 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' + 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0045-linux-bg3-replacer-folder-case.patch b/patches/0045-linux-bg3-replacer-folder-case.patch new file mode 100644 index 0000000..5106a0e --- /dev/null +++ b/patches/0045-linux-bg3-replacer-folder-case.patch @@ -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 { +- 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[] = From 23bdb4feef710e66d342ed41d01e40be636ffd01 Mon Sep 17 00:00:00 2001 From: Yagz <4955479+Yagz@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:51:20 +0100 Subject: [PATCH 3/8] List the hash worker in the main build's Nx outputs Nx keeps its cache in ~/.nx, so a rebuild of the same version restored the main build without hash-worker.cjs. --- .SRCINFO | 2 ++ CHANGELOG.md | 2 ++ PKGBUILD | 2 ++ patches/0046-hash-worker-nx-cache-output.patch | 12 ++++++++++++ 4 files changed, 18 insertions(+) create mode 100644 patches/0046-hash-worker-nx-cache-output.patch diff --git a/.SRCINFO b/.SRCINFO index 5535ab4..ac2ca60 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -102,6 +102,7 @@ pkgbase = vortex-linux source = 0043-linux-steam-prefix-any-library.patch source = 0044-linux-prefix-deployment-drive.patch source = 0045-linux-bg3-replacer-folder-case.patch + source = 0046-hash-worker-nx-cache-output.patch source = vortex.sh source = vortex.desktop source = README.md @@ -162,6 +163,7 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP + sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/CHANGELOG.md b/CHANGELOG.md index f5558de..dd6c6fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ publishes a new Vortex version, taking any pending notes with it. - Baldur's Gate 3 mods that keep their Generated, Public or Data folder inside another folder, such as Upscaled Tattoos and Makeup, no longer end with "Installation canceled". (#38) +- Building the package again for the same Vortex version no longer leaves out + the hash worker, which made archives added by hand fail to hash. (#39) ## 2.11.0-1 - 2026-11-19 diff --git a/PKGBUILD b/PKGBUILD index 9a3446a..a0b4c4a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -146,6 +146,7 @@ _patches=( '0043-linux-steam-prefix-any-library.patch' '0044-linux-prefix-deployment-drive.patch' '0045-linux-bg3-replacer-folder-case.patch' + '0046-hash-worker-nx-cache-output.patch' ) source=( @@ -227,6 +228,7 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' + 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0046-hash-worker-nx-cache-output.patch b/patches/0046-hash-worker-nx-cache-output.patch new file mode 100644 index 0000000..4a5f2db --- /dev/null +++ b/patches/0046-hash-worker-nx-cache-output.patch @@ -0,0 +1,12 @@ +diff --git a/src/main/package.json b/src/main/package.json +--- a/src/main/package.json ++++ b/src/main/package.json +@@ -78,6 +78,8 @@ + "{projectRoot}/build/main.cjs.map", + "{projectRoot}/build/bsdiff-worker.cjs", + "{projectRoot}/build/bsdiff-worker.cjs.map", ++ "{projectRoot}/build/hash-worker.cjs", ++ "{projectRoot}/build/hash-worker.cjs.map", + "{projectRoot}/build/hdiffz.wasm", + "{projectRoot}/build/LICENSE-HDiffPatch.txt", + "{projectRoot}/build/LICENSE-bzip2.txt" From efc9bf736db2f9ee955cbf02d6744f39f2ef5bc0 Mon Sep 17 00:00:00 2001 From: Arkazzae Date: Tue, 24 Nov 2026 13:51:20 +0100 Subject: [PATCH 4/8] Suggest a staging folder before the game's prefix exists The prefix lookup added for hardlinks threw when no prefix was found, so the staging folder suggestion failed instead of using the Linux path as before. --- .../0044-linux-prefix-deployment-drive.patch | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/patches/0044-linux-prefix-deployment-drive.patch b/patches/0044-linux-prefix-deployment-drive.patch index 64d8596..de30929 100644 --- a/patches/0044-linux-prefix-deployment-drive.patch +++ b/patches/0044-linux-prefix-deployment-drive.patch @@ -9,19 +9,28 @@ diff --git a/src/renderer/src/extensions/gamemode_management/util/discovery.ts b import { resolveNativeExecutable, resolvePlatformPath } from "../../../util/nativeExecutable"; import StarterInfo from "../../../util/StarterInfo"; import { getSafe } from "../../../util/storeHelper"; -@@ -756,7 +757,10 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr +@@ -756,7 +757,19 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr } }; - await idModPath(modPaths[""]); + // On Linux, a mod path below a Windows user folder is deployed into the + // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. -+ const modPath = resolveCaseInsensitiveSync(modPaths[""]); ++ // Without a prefix yet, fall back to the Linux path. ++ let modPath = modPaths[""]; ++ try { ++ modPath = resolveCaseInsensitiveSync(modPath); ++ } catch (err) { ++ log("info", "mod path not mapped into a prefix", { ++ modPath, ++ error: getErrorMessageOrDefault(err), ++ }); ++ } + await idModPath(modPath); const statUserData = await fs.statAsync(getVortexPath("userData")); let suggestion: string; -@@ -766,7 +770,7 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr +@@ -766,7 +779,7 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr suggestion = path.join("{USERDATA}", "{game}", "mods"); } else { // different drives, suggest path on same drive @@ -120,7 +129,7 @@ diff --git a/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarg new file mode 100644 --- /dev/null +++ b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts -@@ -0,0 +1,129 @@ +@@ -0,0 +1,153 @@ +import * as fs from "node:fs"; +import * as os from "node:os"; +import * as path from "node:path"; @@ -134,6 +143,7 @@ new file mode 100644 +} from "../../util/compatibilityPaths"; +import type * as selectors from "../../util/selectors"; +import type * as volume from "../../util/volume"; ++import { suggestStagingPath } from "../gamemode_management/util/discovery"; +import type * as modSelectors from "../mod_management/selectors"; +import moveInit from "../move_activator"; +import hardlinkInit from "./index"; @@ -144,6 +154,7 @@ new file mode 100644 + stagingDrive: [] as string[], + staging: "", + modPaths: {} as Record, ++ userData: "", +})); + +vi.mock("../../util/volume", async (original) => { @@ -158,6 +169,8 @@ new file mode 100644 + }; +}); + ++vi.mock("../../util/getVortexPath", () => ({ default: () => fixture.userData })); ++ +vi.mock("../gamemode_management/util/getGame", () => ({ + getGame: () => ({ id: "baldursgate3", getModPaths: () => fixture.modPaths }), +})); @@ -192,6 +205,7 @@ new file mode 100644 + // what the game extension asks for: AppData\Local as Vortex maps it on Linux + linuxModPath = path.join(home, "Local/Larian Studios/Baldur's Gate 3/Mods"); + fixture.modPaths = { "": linuxModPath }; ++ fixture.userData = path.join(home, ".config/Vortex"); + + // the game ran once through Proton, so its profile folder exists in the prefix + fs.mkdirSync( @@ -200,6 +214,7 @@ new file mode 100644 + ); + fs.mkdirSync(gameDir, { recursive: true }); + fs.mkdirSync(fixture.staging, { recursive: true }); ++ fs.mkdirSync(fixture.userData, { recursive: true }); + // the staging folder, the game and the prefix share one drive; home is another + fixture.stagingDrive = [path.join(home, "staging"), path.join(home, "steamapps")]; + @@ -209,7 +224,12 @@ new file mode 100644 + vi.stubEnv("VORTEX_COMPAT_PREFIXES", ""); + setCompatibilityGameProvider(() => ({ path: gameDir, environment: { WINEPREFIX: prefix } })); + -+ state = { settings: { gameMode: { discovered: { [GAME]: { path: gameDir } } } } }; ++ state = { ++ settings: { ++ gameMode: { discovered: { [GAME]: { path: gameDir } } }, ++ mods: { suggestInstallPathDirectory: "Vortex Mods" }, ++ }, ++ }; + }); + + afterEach(() => { @@ -248,6 +268,19 @@ new file mode 100644 + + expect(reason?.description(identity as any)).toMatch(/unavailable/); + }); ++ ++ it("still suggests a staging folder before the prefix exists", async () => { ++ setCompatibilityGameProvider(() => ({ ++ path: gameDir, ++ environment: { WINEPREFIX: path.join(home, "missing") }, ++ })); ++ const api = { getState: () => state } as any; ++ ++ // the fixture keeps the Linux mod path and user data on one real drive ++ await expect(suggestStagingPath(api, GAME)).resolves.toBe( ++ path.join("{USERDATA}", "{game}", "mods"), ++ ); ++ }); + }, +); diff --git a/src/renderer/src/extensions/mod_management/views/Settings.tsx b/src/renderer/src/extensions/mod_management/views/Settings.tsx @@ -261,14 +294,26 @@ diff --git a/src/renderer/src/extensions/mod_management/views/Settings.tsx b/src import { log } from "../../../util/log"; import { showError } from "../../../util/message"; import opn from "../../../util/opn"; -@@ -1054,7 +1055,9 @@ class Settings extends ComponentEx { +@@ -1052,9 +1053,21 @@ class Settings extends ComponentEx { + private suggestPath = async () => { + const { modPaths, onShowError, suggestInstallPathDirectory } = this.props; try { ++ // On Linux, a mod path below a Windows user folder is deployed into the ++ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. ++ // Without a prefix yet, fall back to the Linux path. ++ let modPath = modPaths[""]; ++ try { ++ modPath = resolveCaseInsensitiveSync(modPath); ++ } catch (err) { ++ log("info", "mod path not mapped into a prefix", { ++ modPath, ++ error: getErrorMessageOrDefault(err), ++ }); ++ } // stat the volume root rather than the full mod path — the mod directory // may not exist yet (e.g. first-time setup), but we only need the device id - const volume = getVolumePath(modPaths[""]); -+ // On Linux, a mod path below a Windows user folder is deployed into the -+ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. -+ const volume = getVolumePath(resolveCaseInsensitiveSync(modPaths[""])); ++ const volume = getVolumePath(modPath); const [modPathStats, userDataStats] = await Promise.all([ fs.statAsync(volume), window.api.app.getPath("userData").then((userDataPath) => fs.statAsync(userDataPath)), From 0852cbe6e61296a32a62ad886ee79df252c175d7 Mon Sep 17 00:00:00 2001 From: Arkazzae Date: Tue, 24 Nov 2026 13:51:28 +0100 Subject: [PATCH 5/8] Update THANKS.md --- THANKS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/THANKS.md b/THANKS.md index 5a61728..196a822 100644 --- a/THANKS.md +++ b/THANKS.md @@ -22,5 +22,8 @@ and try the fixes. In order of appearance: - **catsgomoo** showed that Steam can keep a game's Proton prefix on another drive than the game, and shared the launch options for starting Vortex from Steam (#22) +- **Yagz** fixed hardlink deployment into the Proton prefix, Baldur's Gate 3 + mods with a wrapper folder and the hash worker missing from rebuilt packages + (#37, #38, #39) Found something? [Open an issue](https://github.com/Arkazzae/VortexLinux/issues/new). From bbd3a7ad41db0d958f5677922595f02ae4db1f6d Mon Sep 17 00:00:00 2001 From: Arkazzae Date: Tue, 24 Nov 2026 14:04:24 +0100 Subject: [PATCH 6/8] Check drives where deployment writes, not in each caller The volume helpers now look at the same folder as util/fs, so the hardlink, move and staging checks need no changes of their own. Without a prefix they keep the Linux path, as before. --- .SRCINFO | 2 - PKGBUILD | 2 - .../0019-linux-game-prefix-selection.patch | 229 ++++++++++ .../0044-linux-prefix-deployment-drive.patch | 411 ------------------ 4 files changed, 229 insertions(+), 415 deletions(-) delete mode 100644 patches/0044-linux-prefix-deployment-drive.patch diff --git a/.SRCINFO b/.SRCINFO index ac2ca60..7afa721 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -100,7 +100,6 @@ 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 = 0044-linux-prefix-deployment-drive.patch source = 0045-linux-bg3-replacer-folder-case.patch source = 0046-hash-worker-nx-cache-output.patch source = vortex.sh @@ -163,7 +162,6 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP - sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/PKGBUILD b/PKGBUILD index a0b4c4a..b9dc600 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -144,7 +144,6 @@ _patches=( '0041-linux-plugin-folder-prefix.patch' '0042-linux-wine-prefix-setting.patch' '0043-linux-steam-prefix-any-library.patch' - '0044-linux-prefix-deployment-drive.patch' '0045-linux-bg3-replacer-folder-case.patch' '0046-hash-worker-nx-cache-output.patch' ) @@ -228,7 +227,6 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' - 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0019-linux-game-prefix-selection.patch b/patches/0019-linux-game-prefix-selection.patch index 9269dd8..1e0cc5e 100644 --- a/patches/0019-linux-game-prefix-selection.patch +++ b/patches/0019-linux-game-prefix-selection.patch @@ -39,6 +39,179 @@ index 220d69f..c53b742 100644 this.mReduxWatcher = new ReduxWatcher(store, this.watcherError); // Process any pending actions that were deferred during construction +diff --git a/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts +new file mode 100644 +index 0000000..f003a53 +--- /dev/null ++++ b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts +@@ -0,0 +1,167 @@ ++import * as fs from "node:fs"; ++import * as os from "node:os"; ++import * as path from "node:path"; ++ ++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; ++ ++import { makeRealDeploymentMethod } from "../../test-utils/builders"; ++import { ++ resetCompatibilityPathCache, ++ setCompatibilityGameProvider, ++} from "../../util/compatibilityPaths"; ++import { fsTargetPath } from "../../util/getVolumePath"; ++import type * as selectors from "../../util/selectors"; ++import type * as volume from "../../util/volume"; ++import { suggestStagingPath } from "../gamemode_management/util/discovery"; ++import type * as modSelectors from "../mod_management/selectors"; ++import moveInit from "../move_activator"; ++import hardlinkInit from "./index"; ++ ++// Real devices can't be created in a test: every existing path below one of ++// these roots counts as the staging folder's drive, anything else as another. ++const fixture = vi.hoisted(() => ({ ++ stagingDrive: [] as string[], ++ staging: "", ++ modPaths: {} as Record, ++ userData: "", ++})); ++ ++vi.mock("../../util/volume", async (original) => { ++ const actual = await original(); ++ const nodePath = await import("node:path"); ++ return { ++ ...actual, ++ getPathDevice: (input: string) => { ++ const existing = actual.nearestExistingPath(input); ++ return fixture.stagingDrive.some( ++ (root) => existing === root || existing.startsWith(root + nodePath.sep), ++ ) ++ ? 1 ++ : 2; ++ }, ++ }; ++}); ++ ++vi.mock("../../util/getVortexPath", () => ({ default: () => fixture.userData })); ++ ++vi.mock("../gamemode_management/util/getGame", () => ({ ++ getGame: () => ({ id: "baldursgate3", getModPaths: () => fixture.modPaths }), ++})); ++ ++vi.mock("../../util/selectors", async (original) => ({ ++ ...(await original()), ++ installPathForGame: () => fixture.staging, ++})); ++ ++vi.mock("../mod_management/selectors", async (original) => ({ ++ ...(await original()), ++ installPathForGame: () => fixture.staging, ++})); ++ ++const identity = (input: string) => input; ++const GAME = "baldursgate3"; ++ ++describe.runIf(process.platform === "linux")( ++ "drive checks on a mod path inside the game's prefix", ++ () => { ++ let home: string; ++ let prefix: string; ++ let gameDir: string; ++ let linuxModPath: string; ++ let state: any; ++ ++ beforeEach(() => { ++ home = fs.mkdtempSync(path.join(os.tmpdir(), "vortex-prefix-target-")); ++ prefix = path.join(home, "steamapps/compatdata/1086940/pfx"); ++ gameDir = path.join(home, "steamapps/common/Baldurs Gate 3"); ++ fixture.staging = path.join(home, "staging/baldursgate3"); ++ // what the game extension asks for: AppData\Local as Vortex maps it on Linux ++ linuxModPath = path.join(home, "Local/Larian Studios/Baldur's Gate 3/Mods"); ++ fixture.modPaths = { "": linuxModPath }; ++ fixture.userData = path.join(home, ".config/Vortex"); ++ ++ // the game ran once through Proton, so its profile folder exists in the prefix ++ fs.mkdirSync( ++ path.join(prefix, "drive_c/users/steamuser/AppData/Local/Larian Studios/Baldur's Gate 3"), ++ { recursive: true }, ++ ); ++ fs.mkdirSync(gameDir, { recursive: true }); ++ fs.mkdirSync(fixture.staging, { recursive: true }); ++ fs.mkdirSync(fixture.userData, { recursive: true }); ++ // the staging folder, the game and the prefix share one drive; home is another ++ fixture.stagingDrive = [path.join(home, "staging"), path.join(home, "steamapps")]; ++ ++ vi.stubEnv("VORTEX_LINUX_APPDATA", path.join(home, ".config")); ++ vi.stubEnv("VORTEX_LINUX_LOCAL_APPDATA", path.join(home, "Local")); ++ vi.stubEnv("VORTEX_LINUX_DOCUMENTS", path.join(home, "Documents")); ++ vi.stubEnv("VORTEX_COMPAT_PREFIXES", ""); ++ setCompatibilityGameProvider(() => ({ path: gameDir, environment: { WINEPREFIX: prefix } })); ++ ++ state = { ++ settings: { ++ gameMode: { discovered: { [GAME]: { path: gameDir } } }, ++ mods: { suggestInstallPathDirectory: "Vortex Mods" }, ++ }, ++ }; ++ }); ++ ++ afterEach(() => { ++ setCompatibilityGameProvider(undefined); ++ resetCompatibilityPathCache(); ++ vi.unstubAllEnvs(); ++ fs.rmSync(home, { force: true, recursive: true }); ++ }); ++ ++ it("looks at the folder in the prefix", () => { ++ expect(fsTargetPath(linuxModPath)).toBe( ++ path.join( ++ prefix, ++ "drive_c/users/steamuser/AppData/Local/Larian Studios/Baldur's Gate 3/Mods", ++ ), ++ ); ++ }); ++ ++ it.each([ ++ ["hardlink", hardlinkInit], ++ ["move", moveInit], ++ ])("%s deployment compares the staging drive with the prefix", (_name, init) => { ++ const method = makeRealDeploymentMethod({} as any, init); ++ ++ expect(method.isSupported(state, GAME, "")).toBeUndefined(); ++ }); ++ ++ it("still refuses hardlinks when the prefix is on another drive than staging", () => { ++ fixture.stagingDrive = [path.join(home, "staging")]; ++ const method = makeRealDeploymentMethod({} as any, hardlinkInit); ++ ++ const reason = method.isSupported(state, GAME, ""); ++ ++ expect(reason?.description(identity as any)).toMatch(/same drive/); ++ }); ++ ++ it("uses the Linux folder while the game has no prefix", () => { ++ setCompatibilityGameProvider(() => ({ ++ path: gameDir, ++ environment: { WINEPREFIX: path.join(home, "missing") }, ++ })); ++ const method = makeRealDeploymentMethod({} as any, hardlinkInit); ++ ++ expect(fsTargetPath(linuxModPath)).toBe(linuxModPath); ++ const reason = method.isSupported(state, GAME, ""); ++ expect(reason?.description(identity as any)).toMatch(/same drive/); ++ }); ++ ++ it("still suggests a staging folder before the prefix exists", async () => { ++ setCompatibilityGameProvider(() => ({ ++ path: gameDir, ++ environment: { WINEPREFIX: path.join(home, "missing") }, ++ })); ++ const api = { getState: () => state } as any; ++ ++ // the fixture keeps the Linux mod path and user data on one real drive ++ await expect(suggestStagingPath(api, GAME)).resolves.toBe( ++ path.join("{USERDATA}", "{game}", "mods"), ++ ); ++ }); ++ }, ++); diff --git a/src/renderer/src/util/compatibilityPaths.ts b/src/renderer/src/util/compatibilityPaths.ts index a6f2ec8..058df74 100644 --- a/src/renderer/src/util/compatibilityPaths.ts @@ -397,6 +570,40 @@ index 0000000..fb672cd + expect(resolveWindowsUserPathSync(path.join(documents, relative))).toBe(expected); + }); +}); +diff --git a/src/renderer/src/util/getVolumePath.ts b/src/renderer/src/util/getVolumePath.ts +index 40d7ca8..291d6d7 100644 +--- a/src/renderer/src/util/getVolumePath.ts ++++ b/src/renderer/src/util/getVolumePath.ts +@@ -3,6 +3,20 @@ import * as path from "path"; + + import * as winapi from "winapi-bindings"; + ++import { resolveCaseInsensitiveSync } from "./linuxCompatibility"; ++ ++/** ++ * The path util/fs would use: on Linux, Windows user folders such as AppData ++ * move into the game's Wine/Proton prefix. Without a prefix, the path as given. ++ */ ++export function fsTargetPath(input: string): string { ++ try { ++ return resolveCaseInsensitiveSync(path.resolve(input)); ++ } catch { ++ return input; ++ } ++} ++ + /** + * Returns the root of the volume containing the path: the drive on Windows, + * the mount point elsewhere. Like the Windows API, the path doesn't need to exist. +@@ -12,7 +26,7 @@ export function getVolumePath(filePath: string): string { + return winapi.GetVolumePathName(filePath); + } + +- let current = path.resolve(filePath); ++ let current = path.resolve(fsTargetPath(filePath)); + while (!existsSync(current)) { + current = path.dirname(current); + } diff --git a/src/renderer/src/util/linux/steamLibraries.ts b/src/renderer/src/util/linux/steamLibraries.ts new file mode 100644 index 0000000..4b832f0 @@ -554,3 +761,25 @@ index 167f7b6..1be0938 100644 const normalized = path.normalize(input); const root = path.parse(normalized).root; +diff --git a/src/renderer/src/util/volume.ts b/src/renderer/src/util/volume.ts +index f04ed7b..3a38ad9 100644 +--- a/src/renderer/src/util/volume.ts ++++ b/src/renderer/src/util/volume.ts +@@ -3,6 +3,8 @@ import * as path from "node:path"; + + import * as winapi from "winapi-bindings"; + ++import { fsTargetPath } from "./getVolumePath"; ++ + export { getVolumePath } from "./getVolumePath"; + + export interface IDiskSpace { +@@ -19,7 +21,7 @@ function missingPathError(input: string): NodeJS.ErrnoException { + } + + export function nearestExistingPath(input: string): string { +- let current = path.resolve(input); ++ let current = path.resolve(fsTargetPath(input)); + + while (!fs.existsSync(current)) { + const parent = path.dirname(current); diff --git a/patches/0044-linux-prefix-deployment-drive.patch b/patches/0044-linux-prefix-deployment-drive.patch deleted file mode 100644 index de30929..0000000 --- a/patches/0044-linux-prefix-deployment-drive.patch +++ /dev/null @@ -1,411 +0,0 @@ -diff --git a/src/renderer/src/extensions/gamemode_management/util/discovery.ts b/src/renderer/src/extensions/gamemode_management/util/discovery.ts ---- a/src/renderer/src/extensions/gamemode_management/util/discovery.ts -+++ b/src/renderer/src/extensions/gamemode_management/util/discovery.ts -@@ -22,6 +22,7 @@ import type { Normalize } from "../../../util/getNormalizeFunc"; - import getNormalizeFunc from "../../../util/getNormalizeFunc"; - import { getVolumePath } from "../../../util/getVolumePath"; - import getVortexPath from "../../../util/getVortexPath"; -+import { resolveCaseInsensitiveSync } from "../../../util/linuxCompatibility"; - import { resolveNativeExecutable, resolvePlatformPath } from "../../../util/nativeExecutable"; - import StarterInfo from "../../../util/StarterInfo"; - import { getSafe } from "../../../util/storeHelper"; -@@ -756,7 +757,19 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr - } - }; - -- await idModPath(modPaths[""]); -+ // On Linux, a mod path below a Windows user folder is deployed into the -+ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. -+ // Without a prefix yet, fall back to the Linux path. -+ let modPath = modPaths[""]; -+ try { -+ modPath = resolveCaseInsensitiveSync(modPath); -+ } catch (err) { -+ log("info", "mod path not mapped into a prefix", { -+ modPath, -+ error: getErrorMessageOrDefault(err), -+ }); -+ } -+ await idModPath(modPath); - const statUserData = await fs.statAsync(getVortexPath("userData")); - - let suggestion: string; -@@ -766,7 +779,7 @@ export async function suggestStagingPath(api: IExtensionApi, gameId: string): Pr - suggestion = path.join("{USERDATA}", "{game}", "mods"); - } else { - // different drives, suggest path on same drive -- const volume = getVolumePath(modPaths[""]); -+ const volume = getVolumePath(modPath); - suggestion = path.join(volume, state.settings.mods.suggestInstallPathDirectory, "{game}"); - } - -diff --git a/src/renderer/src/extensions/hardlink_activator/index.ts b/src/renderer/src/extensions/hardlink_activator/index.ts ---- a/src/renderer/src/extensions/hardlink_activator/index.ts -+++ b/src/renderer/src/extensions/hardlink_activator/index.ts -@@ -13,6 +13,7 @@ import type { IGame } from "../../types/IGame"; - import type { IState } from "../../types/IState"; - import * as fs from "../../util/fs"; - import { getVolumePath } from "../../util/getVolumePath"; -+import { resolveCaseInsensitiveSync } from "../../util/linuxCompatibility"; - import { installPathForGame } from "../../util/selectors"; - import { assertPathWritable, getPathDevice } from "../../util/volume"; - import type { IDiscoveryResult } from "../gamemode_management/types/IDiscoveryResult"; -@@ -86,15 +87,29 @@ class DeploymentMethod extends LinkingDeployment { - return undefined; - } - -+ const installationPath = installPathForGame(state, gameId); -+ -+ // On Linux, a mod path below a Windows user folder (AppData, Documents, ...) -+ // is deployed into the game's Wine/Proton prefix, not into the Linux folder -+ // the game extension names. Check the folders deployment actually uses. -+ let modPath: string; -+ let stagingPath: string; -+ try { -+ modPath = resolveCaseInsensitiveSync(modPaths[typeId]); -+ stagingPath = resolveCaseInsensitiveSync(installationPath); -+ } catch (err) { -+ return { description: () => getErrorMessageOrDefault(err) }; -+ } -+ - try { - // A deployment path may legitimately not exist until the first file is - // deployed. In that case its nearest existing parent determines whether - // Vortex can create it. -- assertPathWritable(modPaths[typeId]); -+ assertPathWritable(modPath); - } catch { - log("info", "hardlink deployment not supported due to lack of write access", { - typeId, -- path: modPaths[typeId], -+ path: modPath, - }); - return { - description: (t) => t("Can't write to output directory."), -@@ -105,28 +120,26 @@ class DeploymentMethod extends LinkingDeployment { - 'write permission to "{{modPath}}".', - { - replace: { -- modPath: modPaths[typeId], -+ modPath, - }, - }, - ), - }; - } - -- const installationPath = installPathForGame(state, gameId); -- - try { -- if (getPathDevice(installationPath) !== getPathDevice(modPaths[typeId])) { -+ if (getPathDevice(stagingPath) !== getPathDevice(modPath)) { - // hard links work only on the same drive - return { - description: (t) => t("Works only if mods are installed on the same drive as the game."), - order: 5, - solution: (t) => { -- let displayPath = modPaths[typeId]; -+ let displayPath = modPath; - try { -- displayPath = getVolumePath(modPaths[typeId]); -+ displayPath = getVolumePath(modPath); - } catch { - log("warn", "Failed to resolve volume path", { -- path: modPaths[typeId], -+ path: modPath, - }); - } - return t( -@@ -158,7 +171,7 @@ class DeploymentMethod extends LinkingDeployment { - // this can happen when managing the the game for the first time - log("info", "failed to stat. directory missing?", { - dir1: installationPath || "undefined", -- dir2: modPaths[typeId], -+ dir2: modPath, - err: util.inspect(err), - }); - return { -diff --git a/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts -new file mode 100644 ---- /dev/null -+++ b/src/renderer/src/extensions/hardlink_activator/prefixDeploymentTarget.test.ts -@@ -0,0 +1,153 @@ -+import * as fs from "node:fs"; -+import * as os from "node:os"; -+import * as path from "node:path"; -+ -+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -+ -+import { makeRealDeploymentMethod } from "../../test-utils/builders"; -+import { -+ resetCompatibilityPathCache, -+ setCompatibilityGameProvider, -+} from "../../util/compatibilityPaths"; -+import type * as selectors from "../../util/selectors"; -+import type * as volume from "../../util/volume"; -+import { suggestStagingPath } from "../gamemode_management/util/discovery"; -+import type * as modSelectors from "../mod_management/selectors"; -+import moveInit from "../move_activator"; -+import hardlinkInit from "./index"; -+ -+// Real devices can't be created in a test: every path below one of these roots -+// counts as the staging folder's drive, anything else as another drive. -+const fixture = vi.hoisted(() => ({ -+ stagingDrive: [] as string[], -+ staging: "", -+ modPaths: {} as Record, -+ userData: "", -+})); -+ -+vi.mock("../../util/volume", async (original) => { -+ const actual = await original(); -+ const nodePath = await import("node:path"); -+ return { -+ ...actual, -+ getPathDevice: (input: string) => -+ fixture.stagingDrive.some((root) => input === root || input.startsWith(root + nodePath.sep)) -+ ? 1 -+ : 2, -+ }; -+}); -+ -+vi.mock("../../util/getVortexPath", () => ({ default: () => fixture.userData })); -+ -+vi.mock("../gamemode_management/util/getGame", () => ({ -+ getGame: () => ({ id: "baldursgate3", getModPaths: () => fixture.modPaths }), -+})); -+ -+vi.mock("../../util/selectors", async (original) => ({ -+ ...(await original()), -+ installPathForGame: () => fixture.staging, -+})); -+ -+vi.mock("../mod_management/selectors", async (original) => ({ -+ ...(await original()), -+ installPathForGame: () => fixture.staging, -+})); -+ -+const identity = (input: string) => input; -+const GAME = "baldursgate3"; -+ -+describe.runIf(process.platform === "linux")( -+ "deployment methods on a mod path inside the game's prefix", -+ () => { -+ let home: string; -+ let prefix: string; -+ let gameDir: string; -+ let linuxModPath: string; -+ let state: any; -+ -+ beforeEach(() => { -+ home = fs.mkdtempSync(path.join(os.tmpdir(), "vortex-prefix-target-")); -+ prefix = path.join(home, "steamapps/compatdata/1086940/pfx"); -+ gameDir = path.join(home, "steamapps/common/Baldurs Gate 3"); -+ fixture.staging = path.join(home, "staging/baldursgate3"); -+ // what the game extension asks for: AppData\Local as Vortex maps it on Linux -+ linuxModPath = path.join(home, "Local/Larian Studios/Baldur's Gate 3/Mods"); -+ fixture.modPaths = { "": linuxModPath }; -+ fixture.userData = path.join(home, ".config/Vortex"); -+ -+ // the game ran once through Proton, so its profile folder exists in the prefix -+ fs.mkdirSync( -+ path.join(prefix, "drive_c/users/steamuser/AppData/Local/Larian Studios/Baldur's Gate 3"), -+ { recursive: true }, -+ ); -+ fs.mkdirSync(gameDir, { recursive: true }); -+ fs.mkdirSync(fixture.staging, { recursive: true }); -+ fs.mkdirSync(fixture.userData, { recursive: true }); -+ // the staging folder, the game and the prefix share one drive; home is another -+ fixture.stagingDrive = [path.join(home, "staging"), path.join(home, "steamapps")]; -+ -+ vi.stubEnv("VORTEX_LINUX_APPDATA", path.join(home, ".config")); -+ vi.stubEnv("VORTEX_LINUX_LOCAL_APPDATA", path.join(home, "Local")); -+ vi.stubEnv("VORTEX_LINUX_DOCUMENTS", path.join(home, "Documents")); -+ vi.stubEnv("VORTEX_COMPAT_PREFIXES", ""); -+ setCompatibilityGameProvider(() => ({ path: gameDir, environment: { WINEPREFIX: prefix } })); -+ -+ state = { -+ settings: { -+ gameMode: { discovered: { [GAME]: { path: gameDir } } }, -+ mods: { suggestInstallPathDirectory: "Vortex Mods" }, -+ }, -+ }; -+ }); -+ -+ afterEach(() => { -+ setCompatibilityGameProvider(undefined); -+ resetCompatibilityPathCache(); -+ vi.unstubAllEnvs(); -+ fs.rmSync(home, { force: true, recursive: true }); -+ }); -+ -+ it.each([ -+ ["hardlink", hardlinkInit], -+ ["move", moveInit], -+ ])("%s deployment compares the staging drive with the prefix", (_name, init) => { -+ const method = makeRealDeploymentMethod({} as any, init); -+ -+ expect(method.isSupported(state, GAME, "")).toBeUndefined(); -+ }); -+ -+ it("still refuses hardlinks when the prefix is on another drive than staging", () => { -+ fixture.stagingDrive = [path.join(home, "staging")]; -+ const method = makeRealDeploymentMethod({} as any, hardlinkInit); -+ -+ const reason = method.isSupported(state, GAME, ""); -+ -+ expect(reason?.description(identity as any)).toMatch(/same drive/); -+ }); -+ -+ it("reports a missing prefix instead of a write permission problem", () => { -+ setCompatibilityGameProvider(() => ({ -+ path: gameDir, -+ environment: { WINEPREFIX: path.join(home, "missing") }, -+ })); -+ const method = makeRealDeploymentMethod({} as any, hardlinkInit); -+ -+ const reason = method.isSupported(state, GAME, ""); -+ -+ expect(reason?.description(identity as any)).toMatch(/unavailable/); -+ }); -+ -+ it("still suggests a staging folder before the prefix exists", async () => { -+ setCompatibilityGameProvider(() => ({ -+ path: gameDir, -+ environment: { WINEPREFIX: path.join(home, "missing") }, -+ })); -+ const api = { getState: () => state } as any; -+ -+ // the fixture keeps the Linux mod path and user data on one real drive -+ await expect(suggestStagingPath(api, GAME)).resolves.toBe( -+ path.join("{USERDATA}", "{game}", "mods"), -+ ); -+ }); -+ }, -+); -diff --git a/src/renderer/src/extensions/mod_management/views/Settings.tsx b/src/renderer/src/extensions/mod_management/views/Settings.tsx ---- a/src/renderer/src/extensions/mod_management/views/Settings.tsx -+++ b/src/renderer/src/extensions/mod_management/views/Settings.tsx -@@ -49,6 +49,7 @@ import * as fs from "../../../util/fs"; - import getNormalizeFunc from "../../../util/getNormalizeFunc"; - import { getVolumePath } from "../../../util/getVolumePath"; - import getVortexPath from "../../../util/getVortexPath"; -+import { resolveCaseInsensitiveSync } from "../../../util/linuxCompatibility"; - import { log } from "../../../util/log"; - import { showError } from "../../../util/message"; - import opn from "../../../util/opn"; -@@ -1052,9 +1053,21 @@ class Settings extends ComponentEx { - private suggestPath = async () => { - const { modPaths, onShowError, suggestInstallPathDirectory } = this.props; - try { -+ // On Linux, a mod path below a Windows user folder is deployed into the -+ // game's Wine/Proton prefix: suggest a folder on the drive of that prefix. -+ // Without a prefix yet, fall back to the Linux path. -+ let modPath = modPaths[""]; -+ try { -+ modPath = resolveCaseInsensitiveSync(modPath); -+ } catch (err) { -+ log("info", "mod path not mapped into a prefix", { -+ modPath, -+ error: getErrorMessageOrDefault(err), -+ }); -+ } - // stat the volume root rather than the full mod path — the mod directory - // may not exist yet (e.g. first-time setup), but we only need the device id -- const volume = getVolumePath(modPaths[""]); -+ const volume = getVolumePath(modPath); - const [modPathStats, userDataStats] = await Promise.all([ - fs.statAsync(volume), - window.api.app.getPath("userData").then((userDataPath) => fs.statAsync(userDataPath)), -diff --git a/src/renderer/src/extensions/move_activator/index.ts b/src/renderer/src/extensions/move_activator/index.ts ---- a/src/renderer/src/extensions/move_activator/index.ts -+++ b/src/renderer/src/extensions/move_activator/index.ts -@@ -1,6 +1,7 @@ - import * as path from "path"; - import * as util from "util"; - -+import { getErrorMessageOrDefault } from "@vortex/shared"; - import PromiseBB from "bluebird"; - import type { TFunction } from "i18next"; - import type { IEntry } from "turbowalk"; -@@ -12,6 +13,7 @@ import type { IGame } from "../../types/IGame"; - import { UserCanceled } from "../../util/CustomErrors"; - import * as fs from "../../util/fs"; - import { getVolumePath } from "../../util/getVolumePath"; -+import { resolveCaseInsensitiveSync } from "../../util/linuxCompatibility"; - import { log } from "../../util/log"; - import { assertPathWritable, getPathDevice } from "../../util/volume"; - import type { IDiscoveryResult } from "../gamemode_management/types/IDiscoveryResult"; -@@ -90,14 +92,28 @@ class DeploymentMethod extends LinkingDeployment { - }; - } - -+ // On Linux, a mod path below a Windows user folder (AppData, Documents, ...) -+ // is deployed into the game's Wine/Proton prefix, not into the Linux folder -+ // the game extension names. Check the folders deployment actually uses. -+ let modPath: string = modPaths[typeId]; -+ let stagingPath: string; -+ try { -+ if (modPath !== undefined) { -+ modPath = resolveCaseInsensitiveSync(modPath); -+ } -+ stagingPath = resolveCaseInsensitiveSync(instPath); -+ } catch (err) { -+ return { description: () => getErrorMessageOrDefault(err) }; -+ } -+ - try { - // The output directory is commonly created during the first deployment. - // Its existing parent is the relevant permission boundary until then. -- assertPathWritable(modPaths[typeId]); -+ assertPathWritable(modPath); - } catch (err) { - log("info", "move deployment not supported due to lack of write access", { - typeId, -- path: modPaths[typeId], -+ path: modPath, - }); - return { - description: (t) => t("Can't write to output directory"), -@@ -108,7 +124,7 @@ class DeploymentMethod extends LinkingDeployment { - 'be given write permission to "{{modPath}}".', - { - replace: { -- modPath: modPaths[typeId], -+ modPath, - }, - }, - ), -@@ -116,19 +132,19 @@ class DeploymentMethod extends LinkingDeployment { - } - - try { -- if (getPathDevice(instPath) !== getPathDevice(modPaths[typeId])) { -+ if (getPathDevice(stagingPath) !== getPathDevice(modPath)) { - // actually we could support this but it would be so slow it wouldn't make sense - - return { - description: (t) => t("Works only if mods are installed on the same drive as the game"), - order: 8, - solution: (t) => { -- let displayPath = modPaths[typeId]; -+ let displayPath = modPath; - try { -- displayPath = getVolumePath(modPaths[typeId]); -+ displayPath = getVolumePath(modPath); - } catch (err) { - log("warn", "Failed to resolve volume path", { -- path: modPaths[typeId], -+ path: modPath, - }); - } - return t( -@@ -160,7 +176,7 @@ class DeploymentMethod extends LinkingDeployment { - // this can happen when managing the the game for the first time - log("info", "failed to stat. directory missing?", { - dir1: instPath || "undefined", -- dir2: modPaths[typeId], -+ dir2: modPath, - err: util.inspect(err), - }); - return { From 813c1d1c44562117cfb2ffd6795ba0b1d628fd56 Mon Sep 17 00:00:00 2001 From: Arkazzae Date: Tue, 24 Nov 2026 14:04:24 +0100 Subject: [PATCH 7/8] Move the BG3 and hash worker fixes into existing patches --- .SRCINFO | 4 - PKGBUILD | 4 - ...2-linux-extension-path-compatibility.patch | 103 ++++++++++++++++++ patches/0023-linux-native-build.patch | 13 +++ .../0045-linux-bg3-replacer-folder-case.patch | 101 ----------------- .../0046-hash-worker-nx-cache-output.patch | 12 -- 6 files changed, 116 insertions(+), 121 deletions(-) delete mode 100644 patches/0045-linux-bg3-replacer-folder-case.patch delete mode 100644 patches/0046-hash-worker-nx-cache-output.patch diff --git a/.SRCINFO b/.SRCINFO index 7afa721..2387202 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -100,8 +100,6 @@ 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 = 0046-hash-worker-nx-cache-output.patch source = vortex.sh source = vortex.desktop source = README.md @@ -160,8 +158,6 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP - sha512sums = SKIP - sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/PKGBUILD b/PKGBUILD index b9dc600..a6e3e7d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -144,8 +144,6 @@ _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' - '0046-hash-worker-nx-cache-output.patch' ) source=( @@ -225,8 +223,6 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' - 'SKIP' - 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0012-linux-extension-path-compatibility.patch b/patches/0012-linux-extension-path-compatibility.patch index 330a0d1..bfe01ec 100644 --- a/patches/0012-linux-extension-path-compatibility.patch +++ b/patches/0012-linux-extension-path-compatibility.patch @@ -1,3 +1,106 @@ +diff --git a/extensions/games/game-baldursgate3/src/installers.test.ts b/extensions/games/game-baldursgate3/src/installers.test.ts +new file mode 100644 +index 0000000..5d3a7a1 +--- /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 +index a86ee05..11fb743 100644 +--- 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 { +- 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[] = diff --git a/src/renderer/src/util/monkeyPatching.ts b/src/renderer/src/util/monkeyPatching.ts index 8175347..a9e516b 100644 --- a/src/renderer/src/util/monkeyPatching.ts diff --git a/patches/0023-linux-native-build.patch b/patches/0023-linux-native-build.patch index 2aa3b3e..a3500b6 100644 --- a/patches/0023-linux-native-build.patch +++ b/patches/0023-linux-native-build.patch @@ -1,3 +1,16 @@ +diff --git a/src/main/package.json b/src/main/package.json +index eee6df5..3cac02a 100644 +--- a/src/main/package.json ++++ b/src/main/package.json +@@ -78,6 +78,8 @@ + "{projectRoot}/build/main.cjs.map", + "{projectRoot}/build/bsdiff-worker.cjs", + "{projectRoot}/build/bsdiff-worker.cjs.map", ++ "{projectRoot}/build/hash-worker.cjs", ++ "{projectRoot}/build/hash-worker.cjs.map", + "{projectRoot}/build/hdiffz.wasm", + "{projectRoot}/build/LICENSE-HDiffPatch.txt", + "{projectRoot}/build/LICENSE-bzip2.txt" diff --git a/src/main/postinstall.mjs b/src/main/postinstall.mjs index 16a3092..2f6a3ca 100644 --- a/src/main/postinstall.mjs diff --git a/patches/0045-linux-bg3-replacer-folder-case.patch b/patches/0045-linux-bg3-replacer-folder-case.patch deleted file mode 100644 index 5106a0e..0000000 --- a/patches/0045-linux-bg3-replacer-folder-case.patch +++ /dev/null @@ -1,101 +0,0 @@ -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 { -- 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[] = diff --git a/patches/0046-hash-worker-nx-cache-output.patch b/patches/0046-hash-worker-nx-cache-output.patch deleted file mode 100644 index 4a5f2db..0000000 --- a/patches/0046-hash-worker-nx-cache-output.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/main/package.json b/src/main/package.json ---- a/src/main/package.json -+++ b/src/main/package.json -@@ -78,6 +78,8 @@ - "{projectRoot}/build/main.cjs.map", - "{projectRoot}/build/bsdiff-worker.cjs", - "{projectRoot}/build/bsdiff-worker.cjs.map", -+ "{projectRoot}/build/hash-worker.cjs", -+ "{projectRoot}/build/hash-worker.cjs.map", - "{projectRoot}/build/hdiffz.wasm", - "{projectRoot}/build/LICENSE-HDiffPatch.txt", - "{projectRoot}/build/LICENSE-bzip2.txt" From 792ec345f056cd0754ac03527da95a39445d9a3d Mon Sep 17 00:00:00 2001 From: Arkazzae Date: Thu, 26 Nov 2026 00:48:10 +0100 Subject: [PATCH 8/8] Resolve Gamebryo save folders in the active Proton prefix Fixes #40. --- .SRCINFO | 4 +- CHANGELOG.md | 3 + PKGBUILD | 4 +- ...0044-linux-gamebryo-save-directories.patch | 274 ++++++++++++++++++ 4 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 patches/0044-linux-gamebryo-save-directories.patch diff --git a/.SRCINFO b/.SRCINFO index 2387202..3d128b6 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = vortex-linux pkgdesc = Community build of Vortex with generic Linux compatibility patches pkgver = 2.11.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/Arkazzae/VortexLinux install = vortex.install arch = x86_64 @@ -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 = 0044-linux-gamebryo-save-directories.patch source = vortex.sh source = vortex.desktop source = README.md @@ -158,6 +159,7 @@ pkgbase = vortex-linux sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP + sha512sums = SKIP sha512sums = 935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2 sha512sums = e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632 sha512sums = 2161dfa1cf027cdc074de7195b5f206b17ebd829ae415b9e7c9ee5f06d3952b6583030022dbe0d6e9221b5c577c411d7cd5322241f6d2299d9c886641215699b diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b30810..03078b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ publishes a new Vortex version, taking any pending notes with it. ## Unreleased +- Skyrim Special Edition and other Gamebryo games now open and list saves in the + selected Wine or Proton prefix. This also covers profile-specific saves. (#40) + ## 2.11.0-1 - 2026-11-19 - Update to Vortex 2.11.0 and use its Linux dashboard disk-space support. diff --git a/PKGBUILD b/PKGBUILD index a6e3e7d..3b87ae3 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=vortex-linux pkgver=2.11.0 -pkgrel=1 +pkgrel=2 pkgdesc="Community build of Vortex with generic Linux compatibility patches" arch=('x86_64') url="https://github.com/Arkazzae/VortexLinux" @@ -144,6 +144,7 @@ _patches=( '0041-linux-plugin-folder-prefix.patch' '0042-linux-wine-prefix-setting.patch' '0043-linux-steam-prefix-any-library.patch' + '0044-linux-gamebryo-save-directories.patch' ) source=( @@ -223,6 +224,7 @@ sha512sums=( 'SKIP' 'SKIP' 'SKIP' + 'SKIP' # Keep integrity checks for binaries downloaded outside this repository. '935db5c6cee19f2c016e67168bfae7b491044735de76c673abb3b125dd325fd5e779d7efe12ba80178d46689ae70a25e558a3fa846417d44c5f4ca256e7f4bf2' 'e3f31d298a2b674b54c7fc89fb3f06d9645fc5879a54f2ebf2ea20e9ee7ae55f1bfe3284c1f90a591d6be2d6bcd251790ddc27771d65303e7a6a56d331df4632' diff --git a/patches/0044-linux-gamebryo-save-directories.patch b/patches/0044-linux-gamebryo-save-directories.patch new file mode 100644 index 0000000..799b131 --- /dev/null +++ b/patches/0044-linux-gamebryo-save-directories.patch @@ -0,0 +1,274 @@ +diff --git a/extensions/gamebryo-savegame-management/src/index.ts b/extensions/gamebryo-savegame-management/src/index.ts +index 6971724..2879343 100644 +--- a/extensions/gamebryo-savegame-management/src/index.ts ++++ b/extensions/gamebryo-savegame-management/src/index.ts +@@ -24,7 +24,7 @@ import { + mygamesPath, + saveFiles, + } from "./util/gameSupport"; +-import { profileSavePath } from "./util/profileSavePath"; ++import { profileSavePath, resolveSaveDirectory } from "./util/profileSavePath"; + import { refreshSavegames } from "./util/refreshSavegames"; + import restoreSavegamePlugins, { MissingPluginsError } from "./util/restoreSavegamePlugins"; + import transferSavegames from "./util/transferSavegames"; +@@ -42,7 +42,7 @@ function applySaveSettings( + } + // TODO: we should provide a way for the user to set his own + // save path without overwriting it +- iniFile.data.General.SLocalSavePath = savePath; ++ iniFile.data.General.SLocalSavePath = savePath.replaceAll("/", "\\"); + + const { store } = api; + store.dispatch(setSavegamePath(savePath)); +@@ -156,17 +156,18 @@ function openSavegamesDirectory(api: types.IExtensionApi, profileId?: string) { + profileId = selectors.activeProfile(state).id; + } + const profile = state.persistent.profiles[profileId]; +- const hasLocalSaves = util.getSafe(profile, ["features", "local_saves"], false); +- const profileSavesPath = hasLocalSaves +- ? path.join(mygamesPath(profile.gameId), "Saves", profile.id) +- : path.join(mygamesPath(profile.gameId), "Saves"); +- fs.ensureDirAsync(profileSavesPath) +- .then(() => util.opn(profileSavesPath)) +- .catch((err) => +- api.showErrorNotification("Failed to open savegame directory", err, { +- allowReport: (err as any).code !== "ENOENT", +- }), +- ); ++ return openSaveDirectory(api, getSavesPath(profile), true); ++} ++ ++async function openSaveDirectory(api: types.IExtensionApi, savesPath: string, create = false) { ++ try { ++ if (create) await fs.ensureDirAsync(savesPath); ++ await util.opn(await resolveSaveDirectory(savesPath)); ++ } catch (err) { ++ api.showErrorNotification("Failed to open savegame directory", err, { ++ allowReport: (err as any).code !== "ENOENT", ++ }); ++ } + } + + interface IExtensionContextExt extends types.IExtensionContext { +@@ -301,7 +302,7 @@ function once(context: types.IExtensionContext, update: util.Debouncer) { + { + label: "Open Directory", + action: () => { +- util.opn(savesPath); ++ void openSaveDirectory(context.api, savesPath); + }, + }, + ], +diff --git a/extensions/gamebryo-savegame-management/src/util/profileSavePath.ts b/extensions/gamebryo-savegame-management/src/util/profileSavePath.ts +index 307256a..1feeecc 100644 +--- a/extensions/gamebryo-savegame-management/src/util/profileSavePath.ts ++++ b/extensions/gamebryo-savegame-management/src/util/profileSavePath.ts +@@ -1,3 +1,4 @@ ++import { realpath } from "node:fs/promises"; + import * as path from "path"; + + import { types, util } from "@nexusmods/vortex-api"; +@@ -18,3 +19,9 @@ export function profileSavePath(profile: types.IProfile, forceGlobal: boolean = + : "Saves" + path.sep; + } + } ++ ++// The extension filesystem maps My Games into the selected Wine prefix. The ++// desktop opener and turbowalk need the resulting on-disk directory. ++export async function resolveSaveDirectory(savesPath: string): Promise { ++ return process.platform === "linux" ? realpath(savesPath) : savesPath; ++} +diff --git a/extensions/gamebryo-savegame-management/src/util/refreshSavegames.ts b/extensions/gamebryo-savegame-management/src/util/refreshSavegames.ts +index 703a42a..4a9044c 100644 +--- a/extensions/gamebryo-savegame-management/src/util/refreshSavegames.ts ++++ b/extensions/gamebryo-savegame-management/src/util/refreshSavegames.ts +@@ -6,6 +6,7 @@ import turbowalk, { IEntry } from "turbowalk"; + import { CORRUPTED_NAME, MAX_SAVEGAMES } from "../constants"; + import { parseSaveGame } from "../savegame/GamebryoSaveGame"; + import { ISavegame } from "../types/ISavegame"; ++import { resolveSaveDirectory } from "./profileSavePath"; + + // TODO essentially disables cache clearing since we can as many screenshots as the max of + // savegames we will display. +@@ -58,13 +59,16 @@ export function refreshSavegames( + let truncated = false; + let saves: IEntry[] = []; + +- return turbowalk( +- savesPath, +- (entries) => { +- saves = saves.concat(entries.filter((file) => isSavegame(file))); +- }, +- { recurse: false }, +- ) ++ return Promise.resolve(resolveSaveDirectory(savesPath)) ++ .then((directory) => ++ turbowalk( ++ directory, ++ (entries) => { ++ saves = saves.concat(entries.filter((file) => isSavegame(file))); ++ }, ++ { recurse: false }, ++ ), ++ ) + .catch((err) => + ["ENOENT", "ENOTFOUND"].indexOf(err.code) !== -1 ? Promise.resolve() : Promise.reject(err), + ) +diff --git a/extensions/gamebryo-savegame-management/test/saveDirectory.linux.test.ts b/extensions/gamebryo-savegame-management/test/saveDirectory.linux.test.ts +new file mode 100644 +index 0000000..dcd7a15 +--- /dev/null ++++ b/extensions/gamebryo-savegame-management/test/saveDirectory.linux.test.ts +@@ -0,0 +1,152 @@ ++import * as fs from "node:fs"; ++import * as os from "node:os"; ++import * as path from "node:path"; ++ ++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; ++ ++import { setCompatibilityGameProvider } from "../../../src/renderer/src/util/compatibilityPaths"; ++import { wrapExtensionFs } from "../../../src/renderer/src/util/extensionFs"; ++import { resolveCaseInsensitiveSync } from "../../../src/renderer/src/util/linuxCompatibility"; ++import init from "../src/index"; ++ ++vi.mock("../src/views/SavegameList", () => ({ default: {} })); ++// Vortex gives bundled extensions a prefix-aware view of Node's filesystem. ++vi.mock("node:fs/promises", async () => ({ ++ realpath: wrapExtensionFs(fs.promises, "node:fs/promises").realpath, ++})); ++ ++const open = vi.fn(); ++vi.mock("@nexusmods/vortex-api", async () => ({ ++ log: vi.fn(), ++ fs: { ++ ensureDirAsync: (dir: string) => ++ fs.promises.mkdir(resolveCaseInsensitiveSync(dir), { recursive: true }), ++ }, ++ util: { ++ opn: (dir: string) => open(dir), ++ getVortexPath: () => process.env.VORTEX_LINUX_DOCUMENTS, ++ getSafe: (await import("lodash")).default.get, ++ makeOverlayableDictionary: (games) => ({ ...games, get: (id, key) => games[id][key] }), ++ Debouncer: class { ++ schedule = vi.fn(); ++ }, ++ }, ++ selectors: { activeProfile: (state) => state.persistent.profiles.test }, ++})); ++ ++describe.runIf(process.platform === "linux")("Skyrim SE save directories", () => { ++ let root: string; ++ let prefix: string; ++ let saves: string; ++ let hostSaves: string; ++ const profile = { id: "test", gameId: "skyrimse", features: { local_saves: false } }; ++ const getState = () => ({ persistent: { profiles: { test: profile } } }); ++ const api = { ++ getState, ++ store: { getState, dispatch: vi.fn() }, ++ showErrorNotification: vi.fn(), ++ setStylesheet: vi.fn(), ++ onStateChange: vi.fn(), ++ onAsync: vi.fn(), ++ events: { on: vi.fn() }, ++ }; ++ const once = vi.fn(); ++ const registerAction = vi.fn(); ++ const registerMainPage = vi.fn(); ++ ++ beforeEach(() => { ++ vi.clearAllMocks(); ++ profile.features.local_saves = false; ++ root = fs.mkdtempSync(path.join(os.tmpdir(), "vortex-skyrim-saves-")); ++ const steam = path.join(root, "SteamLibrary/steamapps"); ++ const game = path.join(steam, "common/Skyrim Special Edition"); ++ fs.mkdirSync(game, { recursive: true }); ++ fs.writeFileSync( ++ path.join(steam, "appmanifest_489830.acf"), ++ '"AppState"\n{\n"appid" "489830"\n"installdir" "Skyrim Special Edition"\n}', ++ ); ++ prefix = path.join(steam, "compatdata/489830/pfx"); ++ const relative = "My Games/Skyrim Special Edition/Saves"; ++ saves = path.join(prefix, "drive_c/users/steamuser/Documents", relative); ++ hostSaves = path.join(root, "Documents", relative); ++ fs.mkdirSync(saves, { recursive: true }); ++ vi.stubEnv("VORTEX_LINUX_DOCUMENTS", path.join(root, "Documents")); ++ vi.stubEnv("XDG_DATA_HOME", path.join(root, ".local/share")); ++ setCompatibilityGameProvider(() => ({ store: "steam", path: game })); ++ init({ ++ api, ++ registerAction, ++ registerMainPage, ++ registerReducer: vi.fn(), ++ registerProfileFeature: vi.fn(), ++ once, ++ } as unknown as Parameters[0]); ++ }); ++ ++ afterEach(() => { ++ setCompatibilityGameProvider(undefined); ++ vi.unstubAllGlobals(); ++ vi.unstubAllEnvs(); ++ fs.rmSync(root, { recursive: true, force: true }); ++ }); ++ ++ const openAction = (group: string) => ++ registerAction.mock.calls.find( ++ ([where, , , , name]) => where === group && name === "Open Save Games", ++ )![5]; ++ ++ it("opens the detected Proton save folder and creates new profile folders there", async () => { ++ openAction("savegames-icons")(); ++ await vi.waitFor(() => expect(open).toHaveBeenLastCalledWith(saves)); ++ profile.features.local_saves = true; ++ openAction("profile-actions")([profile.id]); ++ await vi.waitFor(() => expect(open).toHaveBeenLastCalledWith(path.join(saves, profile.id))); ++ expect(fs.statSync(path.join(saves, profile.id)).isDirectory()).toBe(true); ++ expect(fs.existsSync(hostSaves)).toBe(false); ++ }); ++ ++ it("lists the prefix saves even when the host has a stale copy", async () => { ++ profile.features.local_saves = true; ++ fs.mkdirSync(hostSaves, { recursive: true }); ++ fs.writeFileSync(path.join(hostSaves, "host.ess"), "stale"); ++ const fixture = path.join(__dirname, "saves/skyrimse/skyrimse_1.ess"); ++ fs.copyFileSync(fixture, path.join(saves, "global.ess")); ++ const { onLoadSaves } = registerMainPage.mock.calls[0][3].props(); ++ expect(await onLoadSaves("__global")).toMatchObject([ ++ { filePath: path.join(saves, "global.ess") }, ++ ]); ++ expect(await onLoadSaves(profile.id)).toEqual([]); ++ fs.mkdirSync(path.join(saves, profile.id)); ++ fs.copyFileSync(fixture, path.join(saves, profile.id, "local.ess")); ++ expect(await onLoadSaves(profile.id)).toMatchObject([ ++ { filePath: path.join(saves, profile.id, "local.ess") }, ++ ]); ++ }); ++ ++ it("writes a relative Windows save path when applying profile settings to Skyrim.ini", async () => { ++ vi.stubGlobal("window", { addEventListener: vi.fn() }); ++ once.mock.calls[0][0](); ++ const applySettings = api.onAsync.mock.calls.find(([event]) => event === "apply-settings")![1]; ++ const iniPath = path.join(path.dirname(hostSaves), "Skyrim.ini"); ++ const ini = { data: { General: { SLocalSavePath: "" } } }; ++ await applySettings(profile, iniPath, ini); ++ expect(ini.data.General.SLocalSavePath).toBe("Saves\\"); ++ profile.features.local_saves = true; ++ await applySettings(profile, iniPath, ini); ++ expect(ini.data.General.SLocalSavePath).toBe("Saves\\test\\"); ++ }); ++ ++ it("reports an unavailable prefix without opening a host folder", async () => { ++ fs.renameSync(prefix, prefix + "-offline"); ++ openAction("savegames-icons")(); ++ await vi.waitFor(() => ++ expect(api.showErrorNotification).toHaveBeenCalledWith( ++ "Failed to open savegame directory", ++ expect.objectContaining({ code: "ENOENT" }), ++ { allowReport: false }, ++ ), ++ ); ++ expect(open).not.toHaveBeenCalled(); ++ expect(fs.existsSync(hostSaves)).toBe(false); ++ }); ++});