Skip to content

Commit 63f7c89

Browse files
committed
Use existing plugins list file regardless of path casing when deploying profiles.
1 parent 0ad880c commit 63f7c89

5 files changed

Lines changed: 38 additions & 8 deletions

File tree

game-db.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,30 +775,30 @@
775775
"steamId": ["1716740"],
776776
"rootDir": "%PROGRAMFILES%\\Steam\\steamapps\\common\\Starfield",
777777
"modDir": "Data",
778-
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\plugins.txt",
778+
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\Plugins.txt",
779779
"configFilePath": "%USERPROFILE%\\Documents\\My Games\\Starfield",
780780
"saveFolderPath": "%USERPROFILE%\\Documents\\My Games\\Starfield\\Saves"
781781
},
782782
{
783783
"steamId": ["1716740"],
784784
"rootDir": "%PROGRAMFILES(X86)%\\Steam\\steamapps\\common\\Starfield",
785785
"modDir": "Data",
786-
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\plugins.txt",
786+
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\Plugins.txt",
787787
"configFilePath": "%USERPROFILE%\\Documents\\My Games\\Starfield",
788788
"saveFolderPath": "%USERPROFILE%\\Documents\\My Games\\Starfield\\Saves"
789789
},
790790
{
791791
"rootDir": "C:\\XboxGames\\Starfield\\Content",
792792
"modDir": "Data",
793-
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\plugins.txt",
793+
"pluginListPath": "%LOCALAPPDATA%\\Starfield\\Plugins.txt",
794794
"configFilePath": "%USERPROFILE%\\Documents\\My Games\\Starfield",
795795
"saveFolderPath": "%USERPROFILE%\\Documents\\My Games\\Starfield\\Saves"
796796
},
797797
{
798798
"steamId": ["1716740"],
799799
"rootDir": "~/.local/share/Steam/steamapps/common/Starfield",
800800
"modDir": "Data",
801-
"pluginListPath": "$/pfx/drive_c/users/steamuser/AppData/Local/Starfield/plugins.txt",
801+
"pluginListPath": "$/pfx/drive_c/users/steamuser/AppData/Local/Starfield/Plugins.txt",
802802
"configFilePath": "$/pfx/drive_c/users/steamuser/Documents/My Games/Starfield",
803803
"saveFolderPath": "$/pfx/drive_c/users/steamuser/Documents/My Games/Starfield/Saves"
804804
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "Mychal Thompson <mychal.r.thompson@gmail.com>",
44
"repository": "https://github.com/lVlyke/stellar-mod-loader",
55
"license": "GPL-3.0",
6-
"version": "0.14.0",
6+
"version": "0.14.1",
77
"main": "electron/main.js",
88
"scripts": {
99
"app:build-dist-debug": "npm run build && npm run package",

src/electron/services/profile-deployment-manager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ export class ProfileDeploymentManager {
131131
}
132132

133133
public async writePluginList(profile: AppProfile): Promise<string> {
134-
const pluginListPath = profile.gameInstallation.pluginListPath
134+
let pluginListPath = profile.gameInstallation.pluginListPath
135135
? path.resolve(PathUtils.expandPath(profile.gameInstallation.pluginListPath))
136136
: undefined;
137137

138138
if (pluginListPath) {
139+
// Use existing plugin file casing if present
140+
pluginListPath = PathUtils.existsIgnoreCase(pluginListPath) ?? pluginListPath;
141+
139142
const pluginListDir = path.dirname(pluginListPath);
140143
fs.mkdirpSync(pluginListDir);
141144

src/electron/util/path-utils.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,31 @@ export namespace PathUtils {
195195

196196
return "";
197197
}
198+
199+
export function existsIgnoreCase(_path: string): string | undefined {
200+
if (fs.existsSync(_path)) {
201+
return _path;
202+
}
203+
204+
let dirName: string | undefined = path.dirname(_path);
205+
206+
// Resolve existing casing of dirName
207+
if (dirName && dirName !== _path) {
208+
dirName = existsIgnoreCase(dirName);
209+
}
210+
211+
// Ensure dirName exists
212+
if (!dirName || !fs.existsSync(dirName)) {
213+
return undefined;
214+
}
215+
216+
// Get all files in dirName
217+
const dirFiles = fs.readdirSync(dirName);
218+
const pathLower = _path.toLowerCase();
219+
220+
// Find any files that match _path regardless of casing
221+
const existingFile = dirFiles.find((dirFile) => path.join(dirName, dirFile).toLowerCase() === pathLower);
222+
223+
return existingFile ? path.join(dirName, existingFile) : undefined;
224+
}
198225
}

0 commit comments

Comments
 (0)