Пример #1
0
 public static DirectoryInfo Combine(
     this DirectoryInfo directory,
     RelativeDirectoryPath directoryPath)
 {
     return(new DirectoryInfo(
                Path.Combine(
                    RelativePath.NormalizeDirectory(directory.FullName),
                    directoryPath.Value.Replace('/', Path.DirectorySeparatorChar))));
 }
Пример #2
0
        public RelativeFilePath(string value) : base(value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                throw new ArgumentException("File path cannot be null or consist entirely of whitespace", nameof(value));
            }

            var(directoryPath, fileName) = GetFileAndDirectoryNames(value);

            FileName = fileName;

            ThrowIfContainsDisallowedFilePathChars(FileName);

            Directory = new RelativeDirectoryPath(directoryPath);

            Value = Directory.Value + FileName;
        }