Exemplo n.º 1
0
        private void InternalBuildForRelativeFile()
        {
            ValidatePathNotRooted();
            if (_validator.HasError) return;

            var filename = new FilenameParser(_fullPath, _validator);
            if (_validator.HasError) return;

            var folders = FoldersParser.WithFilename(filename.PathWithoutFilename, _validator);
            if (_validator.HasError) return;

            _canonical = filename.AppendTo(folders.Canonified);
            ValidateCanonicalPathLength(); // TODO: Should path length be validated for relative paths?
        }
Exemplo n.º 2
0
        private void InternalBuildForRootedFile()
        {
            var drive = new DriveParser(_fullPath, _validator);
            if (_validator.HasError) return;

            var filename = new FilenameParser(drive.PathWithoutDrive, _validator);
            if (_validator.HasError) return;

            var folders = FoldersParser.WithDriveAndFilename(filename.PathWithoutFilename, _validator);
            if (_validator.HasError) return;

            _canonical = drive.AppendTo(filename.AppendTo(folders.Canonified));
            ValidateCanonicalPathLength();
        }
Exemplo n.º 3
0
 private void InternalBuildForFilename()
 {
     var filename = new FilenameParser(_fullPath, _validator);
     _canonical = filename.AppendTo(string.Empty);
     _validator.Ensure<InvalidPathException>(_canonical == _fullPath, "The filename '{0}' is not valid.");
 }