Refactor GetIcdPath

This commit is contained in:
_Neo_
2026-09-13 21:38:20 -05:00
committed by KeatonTheBot
parent b6a9311394
commit e03fc738cd
+9 -2
View File
@@ -9,20 +9,27 @@ namespace Ryujinx.Graphics.Vulkan
{ {
private static string GetIcdPath(string fileName) private static string GetIcdPath(string fileName)
{ {
string contentsDir = Path.GetDirectoryName(AppContext.BaseDirectory.TrimEnd('/'))!; string baseDir = AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
string contentsDir = Path.GetDirectoryName(baseDir)!;
string[] searchPaths = string[] searchPaths =
[ [
// .app bundle:
Path.Combine(contentsDir, "Resources", "vulkan", "icd.d", fileName), Path.Combine(contentsDir, "Resources", "vulkan", "icd.d", fileName),
// Local build:
Path.Combine(contentsDir, fileName) Path.Combine(contentsDir, fileName)
]; ];
foreach (string icdPath in searchPaths) foreach (string icdPath in searchPaths)
{ {
if (File.Exists(icdPath)) if (File.Exists(icdPath))
{
return icdPath; return icdPath;
}
} }
throw new FileNotFoundException($"{fileName} not found"); throw new FileNotFoundException(
$"{fileName} not found. Searched:\n{string.Join(Environment.NewLine, searchPaths)}");
} }
public static void MoltenVK() public static void MoltenVK()