19 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
21 using (var installed = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\EpicGames\Unreal Engine"))
23 if (installed !=
null)
25 foreach (var subKeyName
in installed.GetSubKeyNames())
27 using var subKey = installed.OpenSubKey(subKeyName)!;
28 var candidate = subKey.GetValue(
"InstalledDirectory") as string;
29 if (candidate ==
null)
continue;
31 var path = AbsolutePath.Create(candidate);
32 if (!path.DirectoryExists())
continue;
33 yield
return new(subKeyName, path);
37 using (var sources = Registry.CurrentUser.OpenSubKey(
@"Software\Epic Games\Unreal Engine\Builds"))
41 foreach (var valueName
in sources.GetValueNames())
43 var candidate = sources.GetValue(valueName) as string;
44 if (candidate ==
null)
continue;
46 var path = AbsolutePath.Create(candidate);
47 if (!path.DirectoryExists())
continue;
48 yield
return new(valueName, path);
54 else throw new Exception(
"Trying to use windows implementation of IUnrealLocator on a non-windows platform");