本文整理汇总了C#中FileReference.GetFileNameWithoutExtension方法的典型用法代码示例。如果您正苦于以下问题:C# FileReference.GetFileNameWithoutExtension方法的具体用法?C# FileReference.GetFileNameWithoutExtension怎么用?C# FileReference.GetFileNameWithoutExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReference
的用法示例。
在下文中一共展示了FileReference.GetFileNameWithoutExtension方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UProjectInfo
UProjectInfo(FileReference InFilePath, bool bInIsCodeProject)
{
GameName = InFilePath.GetFileNameWithoutExtension();
FileName = InFilePath.GetFileName();
FilePath = InFilePath;
Folder = FilePath.Directory;
bIsCodeProject = bInIsCodeProject;
}
示例2: GetVisualStudioPathsEntries
/// <summary>
/// Return any custom paths for VisualStudio this platform requires
/// This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="TargetType"> The type of target (game or program)</param>
/// <returns>string The custom path lines for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetRules.TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath)
{
if (!IsNsightInstalled())
{
return base.GetVisualStudioPathsEntries(InPlatform, InConfiguration, TargetType, TargetRulesPath, ProjectFilePath, NMakeOutputPath);
}
// NOTE: We are intentionally overriding defaults for these paths with empty strings. We never want Visual Studio's
// defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
// the environment that UBT is building in. We'll set these environment variables ourselves!
// NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
// environment variable
//@todo android: clean up debug path generation
string GameName = TargetRulesPath.GetFileNameWithoutExtension();
GameName = Path.GetFileNameWithoutExtension(GameName);
// intermediate path for Engine or Game's intermediate
string IntermediateDirectoryPath;
IntermediateDirectoryPath = Path.GetDirectoryName(NMakeOutputPath.FullName) + "/../../Intermediate/Android/APK";
// string for <OverrideAPKPath>
string APKPath = Path.Combine(
Path.GetDirectoryName(NMakeOutputPath.FullName),
Path.GetFileNameWithoutExtension(NMakeOutputPath.FullName) + "-armv7-es2.apk");
// string for <BuildXmlPath> and <AndroidManifestPath>
string BuildXmlPath = IntermediateDirectoryPath;
string AndroidManifestPath = Path.Combine(IntermediateDirectoryPath, "AndroidManifest.xml");
// string for <AdditionalLibraryDirectories>
string AdditionalLibDirs = "";
AdditionalLibDirs += IntermediateDirectoryPath + @"\obj\local\armeabi-v7a";
AdditionalLibDirs += ";" + IntermediateDirectoryPath + @"\obj\local\x86";
AdditionalLibDirs += @";$(AdditionalLibraryDirectories)";
string PathsLines =
" <IncludePath />" + ProjectFileGenerator.NewLine +
" <ReferencePath />" + ProjectFileGenerator.NewLine +
" <LibraryPath />" + ProjectFileGenerator.NewLine +
" <LibraryWPath />" + ProjectFileGenerator.NewLine +
" <SourcePath />" + ProjectFileGenerator.NewLine +
" <ExcludePath />" + ProjectFileGenerator.NewLine +
" <AndroidAttach>False</AndroidAttach>" + ProjectFileGenerator.NewLine +
" <DebuggerFlavor>AndroidDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine +
" <OverrideAPKPath>" + APKPath + "</OverrideAPKPath>" + ProjectFileGenerator.NewLine +
" <AdditionalLibraryDirectories>" + AdditionalLibDirs + "</AdditionalLibraryDirectories>" + ProjectFileGenerator.NewLine +
" <BuildXmlPath>" + BuildXmlPath + "</BuildXmlPath>" + ProjectFileGenerator.NewLine +
" <AndroidManifestPath>" + AndroidManifestPath + "</AndroidManifestPath>" + ProjectFileGenerator.NewLine;
return PathsLines;
}
示例3: CreateProjectRulesAssembly
/// <summary>
/// Creates a rules assembly with the given parameters.
/// </summary>
/// <param name="ProjectFileName">The project file to create rules for. Null for the engine.</param>
/// <param name="ForeignPlugins">List of foreign plugin folders to include in the assembly. May be null.</param>
public static RulesAssembly CreateProjectRulesAssembly(FileReference ProjectFileName)
{
// Check if there's an existing assembly for this project
RulesAssembly ProjectRulesAssembly;
if (!LoadedAssemblyMap.TryGetValue(ProjectFileName, out ProjectRulesAssembly))
{
// Create the engine rules assembly
RulesAssembly Parent = CreateEngineRulesAssembly();
// Find all the rules under the project source directory
DirectoryReference ProjectDirectory = ProjectFileName.Directory;
DirectoryReference ProjectSourceDirectory = DirectoryReference.Combine(ProjectDirectory, "Source");
List<FileReference> ModuleFiles = new List<FileReference>(FindAllRulesFiles(ProjectSourceDirectory, RulesFileType.Module));
List<FileReference> TargetFiles = new List<FileReference>(FindAllRulesFiles(ProjectSourceDirectory, RulesFileType.Target));
// Find all the project plugins
List<PluginInfo> ProjectPlugins = new List<PluginInfo>(Plugins.ReadProjectPlugins(ProjectFileName.Directory));
ProjectDescriptor Project = ProjectDescriptor.FromFile(ProjectFileName.FullName);
// Add the project's additional plugin directories plugins too
ProjectPlugins.AddRange(Plugins.ReadAdditionalPlugins(Project.AdditionalPluginDirectories));
Dictionary<FileReference, PluginInfo> ModuleFileToPluginInfo = new Dictionary<FileReference, PluginInfo>();
FindModuleRulesForPlugins(ProjectPlugins, ModuleFiles, ModuleFileToPluginInfo);
// Add the games project's intermediate source folder
DirectoryReference ProjectIntermediateSourceDirectory = DirectoryReference.Combine(ProjectDirectory, "Intermediate", "Source");
if (ProjectIntermediateSourceDirectory.Exists())
{
TargetFiles.AddRange(FindAllRulesFiles(ProjectIntermediateSourceDirectory, RulesFileType.Target));
}
// Compile the assembly
FileReference AssemblyFileName = FileReference.Combine(ProjectDirectory, BuildConfiguration.BaseIntermediateFolder, "BuildRules", ProjectFileName.GetFileNameWithoutExtension() + "ModuleRules.dll");
ProjectRulesAssembly = new RulesAssembly(ProjectPlugins, ModuleFiles, TargetFiles, ModuleFileToPluginInfo, AssemblyFileName, Parent);
LoadedAssemblyMap.Add(ProjectFileName, ProjectRulesAssembly);
}
return ProjectRulesAssembly;
}
示例4: RequiresTempTarget
private static bool RequiresTempTarget(FileReference RawProjectPath, List<UnrealTargetPlatform> ClientTargetPlatforms, bool AssetNativizationRequested)
{
// check to see if we already have a Target.cs file
if (File.Exists (Path.Combine (Path.GetDirectoryName (RawProjectPath.FullName), "Source", RawProjectPath.GetFileNameWithoutExtension() + ".Target.cs")))
{
return false;
}
else if (Directory.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Source")))
{
// wasn't one in the main Source directory, let's check all sub-directories
//@todo: may want to read each target.cs to see if it has a target corresponding to the project name as a final check
FileInfo[] Files = (new DirectoryInfo( Path.Combine (Path.GetDirectoryName (RawProjectPath.FullName), "Source")).GetFiles ("*.Target.cs", SearchOption.AllDirectories));
if (Files.Length > 0)
{
return false;
}
}
//
// once we reach this point, we can surmise that this is an asset-
// only (code free) project
if (AssetNativizationRequested)
{
// we're going to be converting some of the project's assets
// into native code, so we require a distinct target (executable)
// be generated for this project
return true;
}
// no Target file, now check to see if build settings have changed
List<UnrealTargetPlatform> TargetPlatforms = ClientTargetPlatforms;
if (ClientTargetPlatforms == null || ClientTargetPlatforms.Count < 1)
{
// No client target platforms, add all in
TargetPlatforms = new List<UnrealTargetPlatform>();
foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
{
if (TargetPlatformType != UnrealTargetPlatform.Unknown)
{
TargetPlatforms.Add(TargetPlatformType);
}
}
}
// Change the working directory to be the Engine/Source folder. We are running from Engine/Binaries/DotNET
string oldCWD = Directory.GetCurrentDirectory();
if (BuildConfiguration.RelativeEnginePath == "../../Engine/")
{
string EngineSourceDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetOriginalLocation()), "..", "..", "..", "Engine", "Source");
if (!Directory.Exists(EngineSourceDirectory)) // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
{
EngineSourceDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetOriginalLocation()), "..", "..", "..", "Engine", "Binaries");
}
Directory.SetCurrentDirectory(EngineSourceDirectory);
}
// Read the project descriptor, and find all the plugins available to this project
ProjectDescriptor Project = ProjectDescriptor.FromFile(RawProjectPath.FullName);
DirectoryReference EngineDirectory = new DirectoryReference(BuildConfiguration.RelativeEnginePath);
List<PluginInfo> AvailablePlugins = Plugins.ReadAvailablePlugins(EngineDirectory, RawProjectPath, Project.AdditionalPluginDirectories);
// check the target platforms for any differences in build settings or additional plugins
bool RetVal = false;
foreach (UnrealTargetPlatform TargetPlatformType in TargetPlatforms)
{
UEBuildPlatform BuildPlat = UEBuildPlatform.GetBuildPlatform(TargetPlatformType, true);
if (!Automation.IsEngineInstalled() && BuildPlat != null && !(BuildPlat as UEBuildPlatform).HasDefaultBuildConfig(TargetPlatformType, RawProjectPath.Directory))
{
RetVal = true;
break;
}
// find if there are any plugins enabled or disabled which differ from the default
foreach(PluginInfo Plugin in AvailablePlugins)
{
bool bPluginEnabledForProject = UProjectInfo.IsPluginEnabledForProject(Plugin, Project, TargetPlatformType, TargetRules.TargetType.Game);
if ((bPluginEnabledForProject && !Plugin.Descriptor.bEnabledByDefault) || (bPluginEnabledForProject && Plugin.Descriptor.bInstalled))
{
if(Plugin.Descriptor.Modules.Any(Module => Module.IsCompiledInConfiguration(TargetPlatformType, TargetRules.TargetType.Game, bBuildDeveloperTools: false, bBuildEditor: false)))
{
RetVal = true;
break;
}
}
}
}
// Change back to the original directory
Directory.SetCurrentDirectory(oldCWD);
return RetVal;
}
示例5: CreateHostProject
FileReference CreateHostProject(FileReference HostProjectFile, FileReference PluginFile)
{
DirectoryReference HostProjectDir = HostProjectFile.Directory;
HostProjectDir.CreateDirectory();
// Create the new project descriptor
File.WriteAllText(HostProjectFile.FullName, "{ \"FileVersion\": 3, \"Plugins\": [ { \"Name\": \"" + PluginFile.GetFileNameWithoutExtension() + "\", \"Enabled\": true } ] }");
// Get the plugin directory in the host project, and copy all the files in
DirectoryReference HostProjectPluginDir = DirectoryReference.Combine(HostProjectDir, "Plugins", PluginFile.GetFileNameWithoutExtension());
CommandUtils.ThreadedCopyFiles(PluginFile.Directory.FullName, HostProjectPluginDir.FullName);
CommandUtils.DeleteDirectory(true, DirectoryReference.Combine(HostProjectPluginDir, "Intermediate").FullName);
// Return the path to the plugin file in the host project
return FileReference.Combine(HostProjectPluginDir, PluginFile.GetFileName());
}
示例6: GetAdditionalConsoleAppPath
/// <summary>
/// Helper function to get the console app BinaryName-Cmd.exe filename based on the binary filename.
/// </summary>
/// <param name="BinaryPath">Full path to the binary exe.</param>
/// <returns></returns>
public static FileReference GetAdditionalConsoleAppPath(FileReference BinaryPath)
{
return FileReference.Combine(BinaryPath.Directory, BinaryPath.GetFileNameWithoutExtension() + "-Cmd" + BinaryPath.GetExtension());
}
示例7: CompileCSharpProject
public override void CompileCSharpProject(CSharpEnvironment CompileEnvironment, FileReference ProjectFileName, FileReference DestinationFile)
{
// Initialize environment variables required for spawned tools.
VCEnvironment EnvVars = VCEnvironment.SetEnvironment(CompileEnvironment.EnvironmentTargetPlatform, bSupportWindowsXP);
Action BuildProjectAction = new Action(ActionType.BuildProject);
// Specify the source file (prerequisite) for the action
FileItem ProjectFileItem = FileItem.GetExistingItemByFileReference(ProjectFileName);
if (ProjectFileItem == null)
{
throw new BuildException("Expected C# project file {0} to exist.", ProjectFileName);
}
// Add the project and the files contained to the prerequisites.
BuildProjectAction.PrerequisiteItems.Add(ProjectFileItem);
VCSharpProjectFile ProjectFile = new VCSharpProjectFile(ProjectFileName);
List<string> ProjectPreReqs = ProjectFile.GetCSharpDependencies();
DirectoryReference ProjectFolder = ProjectFileName.Directory;
foreach (string ProjectPreReqRelativePath in ProjectPreReqs)
{
FileReference ProjectPreReqAbsolutePath = FileReference.Combine(ProjectFolder, ProjectPreReqRelativePath);
FileItem ProjectPreReqFileItem = FileItem.GetExistingItemByFileReference(ProjectPreReqAbsolutePath);
if (ProjectPreReqFileItem == null)
{
throw new BuildException("Expected C# dependency {0} to exist.", ProjectPreReqAbsolutePath);
}
BuildProjectAction.PrerequisiteItems.Add(ProjectPreReqFileItem);
}
// We might be able to distribute this safely, but it doesn't take any time.
BuildProjectAction.bCanExecuteRemotely = false;
// Setup execution via MSBuild.
BuildProjectAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory.FullName;
BuildProjectAction.StatusDescription = ProjectFileName.GetFileName();
BuildProjectAction.CommandPath = EnvVars.MSBuildPath;
if (CompileEnvironment.TargetConfiguration == CSharpTargetConfiguration.Debug)
{
BuildProjectAction.CommandArguments = " /target:rebuild /property:Configuration=Debug";
}
else
{
BuildProjectAction.CommandArguments = " /target:rebuild /property:Configuration=Development";
}
// Be less verbose
BuildProjectAction.CommandArguments += " /nologo /verbosity:minimal";
// Add project
BuildProjectAction.CommandArguments += String.Format(" \"{0}\"", ProjectFileItem.AbsolutePath);
// Specify the output files.
FileReference PDBFilePath = FileReference.Combine(DestinationFile.Directory, DestinationFile.GetFileNameWithoutExtension() + ".pdb");
FileItem PDBFile = FileItem.GetItemByFileReference(PDBFilePath);
BuildProjectAction.ProducedItems.Add(FileItem.GetItemByFileReference(DestinationFile));
BuildProjectAction.ProducedItems.Add(PDBFile);
}