Example #1
0
        public virtual Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input)
        {
            string fileSystemPath = GetFileSystemPath(path);

            if (!Directory.Exists(fileSystemPath))
            {
                throw new UserFriendlyException("指定目录不存在!");
            }
            var copyToFilePath = GetFileSystemPath(input.CopyToPath);

            if (Directory.Exists(copyToFilePath))
            {
                throw new UserFriendlyException("指定的路径中已经有同名的目录存在!");
            }

            CopyDirectory(fileSystemPath, copyToFilePath);

            return(Task.CompletedTask);
        }
Example #2
0
 public virtual async Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input)
 {
     await FileSystemAppService.CopyFolderAsync(path, input);
 }
Example #3
0
        public virtual Task CopyFolderAsync([Required, StringLength(255)] string path, FolderCopyDto input)
        {
            string fileSystemPath = GetFileSystemPath(path);

            if (!Directory.Exists(fileSystemPath))
            {
                throw new UserFriendlyException(L["PathNotFound"]);
            }
            var copyToFilePath = GetFileSystemPath(input.CopyToPath);

            if (Directory.Exists(copyToFilePath))
            {
                throw new UserFriendlyException(L["FilePathAlreadyExists"]);
            }

            CopyDirectory(fileSystemPath, copyToFilePath);

            return(Task.CompletedTask);
        }