示例#1
0
        protected override Path GetChildName(Path path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new NullReferenceException("Path can't be null");
            }

            return path.GetChildNameOrSelfIfNoChild();
            //
            //            path = PathIntrinsics.NormalizePath(path);
            //            path = path.TrimEnd('\\');
            //
            //            int num = path.LastIndexOf('\\');
            //            if (num == -1)
            //            {
            //TODO: what is this MakeSlashedPath and should the above GetChildNameOrSelfIfNoChild do somthing like that?
            //                return MakeSlashedPath(path);
            //            }
            //            return path.Substring(num + 1);
        }
示例#2
0
 private void ProcessPath(Path path)
 {
     if (Leaf.IsPresent)
     {
         WritePath(path.GetChildNameOrSelfIfNoChild().RemoveDrive());
     }
     else if (IsAbsolute.IsPresent)
     {
         WriteObject(PathIsAbsolute(path));
     }
     else if (NoQualifier.IsPresent)
     {
         WritePath(path.RemoveDrive());
     }
     else if (Qualifier.IsPresent)
     {
         WritePath(GetDriveOrThrow(path));
     }
     else
     {
         WritePath(path.GetParentPath(string.Empty));
     }
 }