public VFSManager(string mountPoint, IReadOnlyFileSystemProvider vfsProvider) { _mountPoint = mountPoint; if (Directory.Exists(mountPoint)) { _cleanupMountDirOnExit = false; if (Directory.EnumerateFileSystemEntries(mountPoint).Count() > 0) { log.Error($"Mountpoint directory {mountPoint} contains existing files"); throw new InvalidOperationException($"Mount point {mountPoint} must not contain existing files."); } } else { Directory.CreateDirectory(mountPoint); _cleanupMountDirOnExit = true; log.Info($"Mountpoint directory {mountPoint} created."); } log.Info($"Mounting virtual filesystem..."); _dokanTask = Task.Run(() => { var fsFacade = new VirtualFileSystemFacade(); fsFacade.VirtualFileSystemProvider = vfsProvider; fsFacade.Mount(mountPoint); // to allow mount to be viewed over the network, we need to use NetworkDrive option here, and also set the option using dokanctl /i n. This shouldn't be required. }); }
public FileSystemProviderStack(IReadOnlyFileSystemProvider handler, IReadOnlyFileSystemProvider next) { _handler = handler; _next = next; }