Exemple #1
0
 /// <summary>
 /// Gets the local path in Cygwin format (eg. /cygdrive/C/...)
 /// </summary>
 /// <param name="InPath">Local path</param>
 /// <returns>Path in cygwin format</returns>
 private static string GetLocalCygwinPath(FileSystemReference InPath)
 {
     if (InPath.FullName.Length < 2 || InPath.FullName[1] != ':')
     {
         throw new BuildException("Invalid local path for converting to cygwin format ({0}).", InPath);
     }
     return(String.Format("/cygdrive/{0}{1}", InPath.FullName.Substring(0, 1), InPath.FullName.Substring(2).Replace('\\', '/')));
 }
Exemple #2
0
 static bool ShouldInclude(FileSystemReference Reference, string[] InvariantExcludedSuffixes)
 {
     foreach (string InvariantExcludedSuffix in InvariantExcludedSuffixes)
     {
         if (Reference.CanonicalName.EndsWith(InvariantExcludedSuffix))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #3
0
 /// <summary>
 /// Takes the given path and tries to rebase it relative to the project.
 /// </summary>
 public string NormalizeProjectPath(FileSystemReference InputPath)
 {
     // Try to make it relative to the solution directory.
     if (InputPath.IsUnderDirectory(ProjectFileGenerator.MasterProjectPath))
     {
         return(InputPath.MakeRelativeTo(ProjectFileGenerator.IntermediateProjectFilesPath));
     }
     else
     {
         return(InputPath.FullName);
     }
 }
Exemple #4
0
 /// <summary>
 /// Determines if the given path is read-only
 /// </summary>
 /// <param name="Location">The location to check</param>
 /// <returns>True if the path is read-only, false otherwise</returns>
 public bool IsReadOnly(FileSystemReference Location)
 {
     if (Location.IsUnderDirectory(BaseDir))
     {
         return(bReadOnly);
     }
     else if (Parent != null)
     {
         return(Parent.IsReadOnly(Location));
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Reference">Reference to a file or directory in the filesystem</param>
        public FileSystemName(FileSystemReference Reference)
        {
            int Idx = Reference.FullName.LastIndexOf(Path.DirectorySeparatorChar);

            if (Idx == Reference.FullName.Length - 1)
            {
                DisplayName   = Reference.FullName;
                CanonicalName = Reference.CanonicalName;
            }
            else
            {
                DisplayName   = Reference.FullName.Substring(Idx + 1);
                CanonicalName = Reference.CanonicalName.Substring(Idx + 1);
            }
        }
Exemple #6
0
        static bool ShouldInclude(FileSystemReference Reference, string[] ExcludedSuffixes)
        {
            // Ignore Mac resource fork files on non-HFS partitions
            if (Path.GetFileName(Reference.FullName).StartsWith("._"))
            {
                return(false);
            }

            foreach (string ExcludedSuffix in ExcludedSuffixes)
            {
                if (Reference.FullName.EndsWith(ExcludedSuffix, FileSystemReference.Comparison))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #7
0
        static bool ShouldInclude(FileSystemReference Reference, string[] InvariantExcludedSuffixes)
        {
            // Ignore Mac resource fork files on non-HFS partitions
            if (Path.GetFileName(Reference.FullName).StartsWith("._"))
            {
                return(false);
            }

            foreach (string InvariantExcludedSuffix in InvariantExcludedSuffixes)
            {
                if (StringUtils.FastEndsWith(Reference.FullName, InvariantExcludedSuffix))
                {
                    return(false);
                }
            }
            return(true);
        }
 private static bool ExtractWrappedIncludeFile(FileSystemReference FileRef, out string CorrectFilePathPch)
 {
     CorrectFilePathPch = "";
     try
     {
         using (StreamReader Reader = new StreamReader(FileRef.FullName))
         {
             string Line = Reader.ReadLine();
             if (Line != null)
             {
                 CorrectFilePathPch = Line.Substring("// PCH for ".Length).Trim();
                 return(true);
             }
         }
     }
     finally
     {
         Log.TraceVerbose("Couldn't extract path to PCH from {0}", FileRef);
     }
     return(false);
 }
Exemple #9
0
 /// <summary>
 /// Converts a local path into a remote one
 /// </summary>
 /// <param name="LocalPath">The local path to convert</param>
 /// <returns>Equivalent remote path</returns>
 private string GetRemotePath(FileSystemReference LocalPath)
 {
     return(GetRemotePath(LocalPath.FullName));
 }
        /// <summary>
        /// Combine several fragments with a base directory, to form a new filename
        /// </summary>
        /// <param name="BaseDirectory">The base directory</param>
        /// <param name="Fragments">Fragments to combine with the base directory</param>
        /// <returns>The new file name</returns>
        public static FileReference Combine(DirectoryReference BaseDirectory, params string[] Fragments)
        {
            string FullName = FileSystemReference.CombineStrings(BaseDirectory, Fragments);

            return(new FileReference(FullName, FullName.ToLowerInvariant()));
        }