MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetPlatform

Method GetPlatform

Source/Tools/Flax.Build/Build/Platform.cs:226–245  ·  view source on GitHub ↗

Creates the build toolchain for a given platform and architecture. The target platform. True if return null platform if it's missing, otherwise will invoke an exception. The platform.

(TargetPlatform targetPlatform, bool nullIfMissing = false)

Source from the content-addressed store, hash-verified

224 /// <param name="nullIfMissing">True if return null platform if it's missing, otherwise will invoke an exception.</param>
225 /// <returns>The platform.</returns>
226 public static Platform GetPlatform(TargetPlatform targetPlatform, bool nullIfMissing = false)
227 {
228 if (_platforms == null)
229 {
230 using (new ProfileEventScope("GetPlatforms"))
231 _platforms = Builder.BuildTypes.Where(x => x.IsClass && !x.IsAbstract && x.IsSubclassOf(typeof(Platform))).Select(Activator.CreateInstance).Cast<Platform>().ToArray();
232 }
233
234 foreach (var platform in _platforms)
235 {
236 if (platform.Target == targetPlatform)
237 {
238 return platform;
239 }
240 }
241
242 if (nullIfMissing)
243 return null;
244 throw new Exception(string.Format("Platform {0} is not supported.", targetPlatform));
245 }
246
247 /// <summary>
248 /// Tries to create the build toolchain for a given architecture. Returns null if platform is not supported.

Callers 13

SolutionConfigurationMethod · 0.45
GenerateProjectMethod · 0.45
GenerateSolutionMethod · 0.45
RunMethod · 0.45
BuildMethod · 0.45
BuildMethod · 0.45
BuildMethod · 0.45
CleanMethod · 0.45
BuildTargetsMethod · 0.45
InitPlatformsMethod · 0.45

Calls 5

WhereMethod · 0.80
FormatMethod · 0.80
ToArrayMethod · 0.45
SelectMethod · 0.45
IsSubclassOfMethod · 0.45

Tested by

no test coverage detected