Limit Run target platforms to plugin declarations

This commit is contained in:
npc0-hue
2026-08-26 16:45:43 +08:00
parent 35f1eb0844
commit 861ee752ed
2 changed files with 16 additions and 6 deletions
+7 -4
View File
@@ -981,7 +981,7 @@ function quickRuntimeDefaultsForPlugin(pluginId: string) {
};
}
function runPlatformOptions(plugin: GamePluginResponse | undefined, fallback: string): string[] {
export function runPlatformOptions(plugin: GamePluginResponse | undefined, fallback: string): string[] {
const options = new Set<string>();
const add = (value: string | undefined) => {
const normalized = value?.trim().toLowerCase();
@@ -989,10 +989,13 @@ function runPlatformOptions(plugin: GamePluginResponse | undefined, fallback: st
options.add(normalized);
}
};
add(fallback);
plugin?.supportedOs?.forEach(add);
plugin?.runtimeProfiles?.lifecycleProfiles?.forEach((profile) => profile.platforms?.forEach(add));
["linux", "windows", "darwin"].forEach(add);
if (options.size === 0) {
plugin?.runtimeProfiles?.lifecycleProfiles?.forEach((profile) => profile.platforms?.forEach(add));
}
if (options.size === 0) {
add(fallback);
}
return [...options];
}