Orc.NuGetExplorer.BackupFileSystemService.BackupFolder C# (CSharp) Method

BackupFolder() public method

public BackupFolder ( string fullPath ) : void
fullPath string
return void
        public void BackupFolder(string fullPath)
        {
            Log.Info("Creating backup for {0}", fullPath);

            try
            {
                var parentDirectory = Catel.IO.Path.GetParentDirectory(fullPath);
                var directoryName = Catel.IO.Path.GetRelativePath(fullPath, parentDirectory);
                var destinationDirectory = _operationContextService.CurrentContext.FileSystemContext.GetDirectory(directoryName);

                _fileSystemService.CopyDirectory(fullPath, destinationDirectory);
            }
            catch (Exception exception)
            {
                Log.Error(exception, "Failed to create backup for {0}", fullPath);
            }
        }