示例#1
0
        public void CopyFile(string path, string newPath, bool overwrite = false)
        {
            Guard.NotEmpty(path, nameof(path));
            Guard.NotEmpty(newPath, nameof(newPath));

            var sourceFile = _mediaService.GetFileByPath(path);

            if (sourceFile == null)
            {
                throw _exceptionFactory.FileNotFound(path);
            }

            _mediaService.CopyFile(
                sourceFile,
                newPath,
                overwrite ? DuplicateFileHandling.Overwrite : DuplicateFileHandling.ThrowError);
        }