private static String GetDirName(String fullPath) { Debug.Assert(fullPath != null); return(PathHelpers.IsRoot(fullPath) ? fullPath : Path.GetFileName(PathHelpers.TrimEndingDirectorySeparator(fullPath))); }
private void Init(string originalPath, string fullPath = null, string fileName = null, bool isNormalized = false) { // Want to throw the original argument name OriginalPath = originalPath ?? throw new ArgumentNullException("path"); fullPath = fullPath ?? originalPath; fullPath = isNormalized ? fullPath : Path.GetFullPath(fullPath); _name = fileName ?? (PathHelpers.IsRoot(fullPath) ? fullPath : Path.GetFileName(PathHelpers.TrimEndingDirectorySeparator(fullPath))); FullPath = fullPath; }
private void Init(string originalPath, string fullPath = null, string fileName = null, bool isNormalized = false) { // Want to throw the original argument name OriginalPath = originalPath ?? throw new ArgumentNullException("path"); fullPath = fullPath ?? originalPath; Debug.Assert(!isNormalized || !PathInternal.IsPartiallyQualified(fullPath), $"'{fullPath}' should be fully qualified if normalized"); fullPath = isNormalized ? fullPath : Path.GetFullPath(fullPath); _name = fileName ?? (PathHelpers.IsRoot(fullPath) ? fullPath : Path.GetFileName(PathHelpers.TrimEndingDirectorySeparator(fullPath))); FullPath = fullPath; }