private static void GetPaths() { engineVersion = FBuild.EngineMajorVersion + "." + FBuild.EngineMinorVersion; projectName = FApp.GetProjectName(); // /Engine/Plugins/USharp/Binaries/Win64/ - move it up to /Engine/Plugins/USharp/ pluginBaseDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName( FModuleManager.Instance.GetModuleFilename((FName)"USharp")), "..", "..")); // /ProjectName/ projectDir = Path.GetFullPath(FPaths.ProjectDir); // /ProjectName/Managed/ projectManagedDir = Path.Combine(projectDir, "Managed"); // /ProjectName/Managed/USharpProject.props projectManagedPropsFile = Path.Combine(projectManagedDir, "USharpProject.props"); // Update the %appdata%/USharp/UE_XXXX file which is used by USharpProject.props to look up USharp.props string appDataFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "USharp", "UE_" + engineVersion + ".txt"); if (!File.Exists(appDataFile) || File.ReadAllText(appDataFile) != pluginBaseDir) { File.WriteAllText(appDataFile, pluginBaseDir); } }
public static UnrealModuleType GetModuleType(string moduleName, string modulePath, IPlugin[] plugins) { if (File.Exists(modulePath)) { string moduleDir = FPaths.GetPath(modulePath); if (FPaths.DirectoryExists(moduleDir)) { if (FPaths.IsSameOrSubDirectory(FPaths.EnginePluginsDir, moduleDir)) { return(UnrealModuleType.EnginePlugin); } else if (FPaths.IsSameOrSubDirectory(FPaths.Combine(FPaths.EngineDir, "Binaries"), moduleDir)) { return(UnrealModuleType.Engine); } else if (FPaths.IsSameOrSubDirectory(FPaths.ProjectPluginsDir, moduleDir)) { return(UnrealModuleType.GamePlugin); } else { foreach (IPlugin plugin in plugins) { if (plugin.Name == moduleName) { switch (plugin.PluginType) { case EPluginType.Engine: case EPluginType.Enterprise: case EPluginType.External: return(UnrealModuleType.EnginePlugin); case EPluginType.Mod: case EPluginType.Project: return(UnrealModuleType.GamePlugin); } } } if (FPaths.IsSameOrSubDirectory(FPaths.ProjectDir, moduleDir) && moduleName.Equals(FApp.GetProjectName(), StringComparison.OrdinalIgnoreCase)) { return(UnrealModuleType.Game); } } } } return(UnrealModuleType.Unknown); }