/// <summary>
 /// Enumerate files from a given directory
 /// </summary>
 /// <returns>Sequence of file references</returns>
 public IEnumerable <FileReference> EnumerateFileReferences(string Pattern, SearchOption Option)
 {
     foreach (string FileName in Directory.EnumerateFiles(FullName, Pattern, Option))
     {
         yield return(FileReference.MakeFromNormalizedFullPath(FileName));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Enumerate files from a given directory
 /// </summary>
 /// <returns>Sequence of file references</returns>
 public static IEnumerable <FileReference> EnumerateFiles(DirectoryReference BaseDir, string Pattern)
 {
     foreach (string FileName in Directory.EnumerateFiles(BaseDir.FullName, Pattern))
     {
         yield return(FileReference.MakeFromNormalizedFullPath(FileName));
     }
 }
 /// <summary>
 /// Enumerate files from a given directory
 /// </summary>
 /// <returns>Sequence of file references</returns>
 public IEnumerable <FileReference> EnumerateFileReferences()
 {
     foreach (string FileName in Directory.EnumerateFiles(FullName))
     {
         yield return(FileReference.MakeFromNormalizedFullPath(FileName));
     }
 }
        /// <summary>
        /// Manually deserialize a file reference from a binary stream.
        /// </summary>
        /// <param name="Reader">Binary reader to read from</param>
        /// <returns>New FileReference object</returns>
        public static FileReference ReadFileReference(this BinaryReader Reader)
        {
            string FullName = Reader.ReadString();

            return((FullName.Length == 0) ? null : FileReference.MakeFromNormalizedFullPath(FullName));
        }
Esempio n. 5
0
        private FileReference GetExecutableFilename(ProjectFile Project, ProjectTarget Target, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration)
        {
            TargetRules   TargetRulesObject = Target.TargetRules;
            FileReference TargetFilePath    = Target.TargetFilePath;
            string        TargetName        = TargetFilePath == null?Project.ProjectFilePath.GetFileNameWithoutExtension() : TargetFilePath.GetFileNameWithoutAnyExtensions();

            string UBTPlatformName      = Platform.ToString();
            string UBTConfigurationName = Configuration.ToString();

            string ProjectName = Project.ProjectFilePath.GetFileNameWithoutExtension();

            // Setup output path
            UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);

            // Figure out if this is a monolithic build
            bool bShouldCompileMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Platform);

            if (TargetRulesObject != null)
            {
                bShouldCompileMonolithic |= (Target.CreateRulesDelegate(Platform, Configuration).GetLegacyLinkType(Platform, Configuration) == TargetLinkType.Monolithic);
            }

            TargetType TargetRulesType = Target.TargetRules == null ? TargetType.Program : Target.TargetRules.Type;

            // Get the output directory
            DirectoryReference RootDirectory = UnrealBuildTool.EngineDirectory;

            if (TargetRulesType != TargetType.Program && (bShouldCompileMonolithic || TargetRulesObject.BuildEnvironment == TargetBuildEnvironment.Unique) && !TargetRulesObject.bOutputToEngineBinaries)
            {
                if (OnlyGameProject != null && TargetFilePath.IsUnderDirectory(OnlyGameProject.Directory))
                {
                    RootDirectory = OnlyGameProject.Directory;
                }
                else
                {
                    FileReference ProjectFileName;
                    if (UProjectInfo.TryGetProjectFileName(ProjectName, out ProjectFileName))
                    {
                        RootDirectory = ProjectFileName.Directory;
                    }
                }
            }

            if (TargetRulesType == TargetType.Program && (TargetRulesObject == null || !TargetRulesObject.bOutputToEngineBinaries))
            {
                FileReference ProjectFileName;
                if (UProjectInfo.TryGetProjectForTarget(TargetName, out ProjectFileName))
                {
                    RootDirectory = ProjectFileName.Directory;
                }
            }

            // Get the output directory
            DirectoryReference OutputDirectory = DirectoryReference.Combine(RootDirectory, "Binaries", UBTPlatformName);

            // Get the executable name (minus any platform or config suffixes)
            string BaseExeName = TargetName;

            if (!bShouldCompileMonolithic && TargetRulesType != TargetType.Program)
            {
                // Figure out what the compiled binary will be called so that we can point the IDE to the correct file
                string TargetConfigurationName = TargetRulesType.ToString();
                if (TargetConfigurationName != TargetType.Game.ToString() && TargetConfigurationName != TargetType.Program.ToString())
                {
                    BaseExeName = "UE4" + TargetConfigurationName;
                }
            }

            // Make the output file path
            string ExecutableFilename = FileReference.Combine(OutputDirectory, BaseExeName).ToString();

            if ((Configuration != UnrealTargetConfiguration.DebugGame || bShouldCompileMonolithic))
            {
                ExecutableFilename += "-" + UBTPlatformName + "-" + UBTConfigurationName;
            }
            ExecutableFilename += TargetRulesObject.Architecture;
            ExecutableFilename += BuildPlatform.GetBinaryExtension(UEBuildBinaryType.Executable);

            return(FileReference.MakeFromNormalizedFullPath(ExecutableFilename));
        }