コード例 #1
0
ファイル: DirectoryInfo.cs プロジェクト: jnm2/corefx
        private static String GetDirName(String fullPath)
        {
            Debug.Assert(fullPath != null);

            return(PathHelpers.IsRoot(fullPath) ?
                   fullPath :
                   Path.GetFileName(PathHelpers.TrimEndingDirectorySeparator(fullPath)));
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }