private IEnumerable <IOperation> StoreDirectory(IDirectoryObject directory, IExecutionContext context) { var directoryStorePath = GetStorePath(directory); var destination = _backupDirectory.CombineDirectory(directoryStorePath); yield return(new CreateDirectoryOperation(destination, context.ServiceContainer.Get <IFileSystem>(), context)); // TODO: Should set dates as well? // TODO: Should set attributes? }
public DirectoryStorageInstance(DirectoryStorage storage, IExecutionContext context) { var textFormatter = context.ServiceContainer.Get <ITextFormatter>(); var fileSystem = context.ServiceContainer.Get <IFileSystem>(); var path = textFormatter.Format(storage.Path); var directoryName = textFormatter.Format(storage.Options.DirectoryName); _storage = storage; _storageDirectory = new DirectoryObject(path, fileSystem); _backupDirectory = _storageDirectory.CombineDirectory(directoryName); if (_storageDirectory.Exists) { _oldBackupDirectories = _storageDirectory.GetDirectories(context).ToArray(); } else { _oldBackupDirectories = new DirectoryObject[0]; } _hardLinksEnabled = _storage.Options.EnableHardLinks && _storageDirectory.Drive.SupportsHardLinks; }