Skip to content

Commit c3a073d

Browse files
Merge pull request #2166 from ebkr/fix-shimloader-casing
Fix shimloader installation failure on Linux
2 parents e080332 + 8fd7c7c commit c3a073d

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

‎src/installers/ShimloaderInstaller.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ export class ShimloaderInstaller implements PackageInstaller {
1919
const fs = FsProvider.instance;
2020
const fileRelocations = new Map<string, string>();
2121

22+
const entries = await fs.readdir(path.join(packagePath, "UE4SS"));
23+
const findUE4SS = (name: string) =>
24+
entries.find(f => f.toLowerCase() === name.toLowerCase()) ?? name;
25+
2226
const targets = [
2327
["dwmapi.dll", "dwmapi.dll"],
24-
["UE4SS/ue4ss.dll", "ue4ss.dll"],
25-
["UE4SS/UE4SS-settings.ini", "UE4SS-settings.ini"],
28+
[`UE4SS/${findUE4SS("ue4ss.dll")}`, "ue4ss.dll"],
29+
[`UE4SS/${findUE4SS("UE4SS-settings.ini")}`, "UE4SS-settings.ini"],
2630
];
2731

2832
const ue4ssTree = await FileTree.buildFromLocation(path.join(packagePath, "UE4SS/Mods"));

‎test/vitest/tests/unit/Installers/ModLoader/Shimloader.Tests.spec.ts‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import {
77
} from '../../../../utils/InstallLogicUtils';
88
import { PluginInstallers } from '../../../../../../src/installers/registry';
99
import { InstallRulePluginInstaller } from '../../../../../../src/installers/InstallRulePluginInstaller';
10+
import { ShimloaderInstaller } from '../../../../../../src/installers/ShimloaderInstaller';
11+
import { getInstallArgs } from '../../../../../../src/installers/PackageInstaller';
1012
import { PackageLoader } from '../../../../../../src/model/schema/ThunderstoreSchema';
1113
import Profile from '../../../../../../src/model/Profile';
1214
import R2Error from '../../../../../../src/model/errors/R2Error';
15+
import InMemoryFsProvider from '../../../../stubs/providers/InMemory.FsProvider';
1316
import ProfileInstallerProvider from '../../../../../../src/providers/ror2/installing/ProfileInstallerProvider';
1417
import GenericProfileInstaller from '../../../../../../src/r2mm/installing/profile_installers/GenericProfileInstaller';
1518
import { RuleSubtype } from '../../../../../../src/r2mm/installing/InstallationRules';
@@ -137,4 +140,45 @@ describe('Shimloader Installer Tests', () => {
137140
await expectFilesToBeCopied(sourceToExpectedDestination);
138141
});
139142
});
143+
144+
describe('Mod loader installation (case-sensitive FS)', () => {
145+
146+
// Test https://github.com/ebkr/r2modmanPlus/issues/2079
147+
beforeEach(async () => {
148+
await installLogicBeforeEach("Palworld");
149+
InMemoryFsProvider.setMatchMode("CASE_SENSITIVE");
150+
});
151+
152+
test("Installs new UE4SS.dll", async () => {
153+
const pkg = createManifest("unreal_shimloader", "Thunderstore");
154+
const sourceToExpectedDestination = {
155+
"dwmapi.dll": "dwmapi.dll",
156+
"UE4SS/UE4SS.dll": "ue4ss.dll",
157+
"UE4SS/UE4SS-settings.ini": "UE4SS-settings.ini",
158+
"UE4SS/Mods/shared/Types.lua": "shimloader/mod/shared/Types.lua",
159+
};
160+
await createPackageFilesIntoCache(pkg, Object.keys(sourceToExpectedDestination));
161+
162+
const profile = Profile.getActiveProfile().asImmutableProfile();
163+
await new ShimloaderInstaller().install(getInstallArgs(pkg, profile));
164+
165+
await expectFilesToBeCopied(sourceToExpectedDestination);
166+
});
167+
168+
test("Installs old ue4ss.dll", async () => {
169+
const pkg = createManifest("unreal_shimloader", "Thunderstore");
170+
const sourceToExpectedDestination = {
171+
"dwmapi.dll": "dwmapi.dll",
172+
"UE4SS/ue4ss.dll": "ue4ss.dll",
173+
"UE4SS/UE4SS-settings.ini": "UE4SS-settings.ini",
174+
"UE4SS/Mods/shared/Types.lua": "shimloader/mod/shared/Types.lua",
175+
};
176+
await createPackageFilesIntoCache(pkg, Object.keys(sourceToExpectedDestination));
177+
178+
const profile = Profile.getActiveProfile().asImmutableProfile();
179+
await new ShimloaderInstaller().install(getInstallArgs(pkg, profile));
180+
181+
await expectFilesToBeCopied(sourceToExpectedDestination);
182+
});
183+
});
140184
});

0 commit comments

Comments
 (0)