示例#1
0
        /// <summary>
        /// Writes a PathAtom using its underlying string representation
        /// </summary>
        public override void Write(PathAtom value)
        {
            Start <PathAtom>();
            Write(value.IsValid);
            if (value.IsValid)
            {
                Write(value.ToString(m_stringTable));
            }

            End();
        }
示例#2
0
        /// <summary>
        /// Creates an expanded path with file name matching the given file name casing. This is used to ensure expanded path file name
        /// casing which is different than that which is in the path table
        /// </summary>
        public ExpandedAbsolutePath WithFileName(PathTable pathTable, PathAtom fileNameAtom)
        {
            Contract.Assert(fileNameAtom.CaseInsensitiveEquals(pathTable.StringTable, Path.GetName(pathTable)), "File name should only differ by casing");

            var fileName = fileNameAtom.ToString(pathTable.StringTable);

            if (ExpandedPath.EndsWith(fileName, StringComparison.Ordinal))
            {
                return(this);
            }

            return(new ExpandedAbsolutePath(Path, ExpandedPath.Remove(ExpandedPath.Length - fileName.Length) + fileName));
        }