Пример #1
0
        private DirectoryEntry ResolveDestinationDirectory([NotNull] AbsolutePath sourcePath,
                                                           [NotNull] AbsolutePath destinationPath, [NotNull] FileEntry sourceFile)
        {
            var destinationResolver = new FileResolver(Root)
            {
                ErrorFileFoundAsDirectory     = _ => ErrorFactory.System.CannotCreateFileBecauseFileAlreadyExists(),
                ErrorDirectoryFoundAsFile     = _ => ErrorFactory.System.DirectoryNotFound(),
                ErrorLastDirectoryFoundAsFile = _ => ErrorFactory.System.ParameterIsIncorrect(),
                ErrorDirectoryNotFound        = _ => ErrorFactory.System.DirectoryNotFound(),
                ErrorPathIsVolumeRoot         = _ => ErrorFactory.System.FileOrDirectoryOrVolumeIsIncorrect(),
                ErrorFileExists = _ => ErrorFactory.System.CannotCreateFileBecauseFileAlreadyExists()
            };

            bool isFileCasingChangeOnly = IsFileCasingChangeOnly(sourcePath, destinationPath);

            return(isFileCasingChangeOnly
                ? sourceFile.Parent
                : destinationResolver.ResolveContainingDirectoryForMissingFile(destinationPath));
        }