-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
I was playing about and came up with this code:
using SharpFileSystem;
using SharpFileSystem.FileSystems;
using System.IO;
class Program
{
static void Main(string[] args)
{
var fs = new PhysicalFileSystem(".");
var originalPath = FileSystemPath.Root.AppendFile("x");
using (var x = fs.CreateFile(originalPath))
using (var xWriter = new StreamWriter(x))
xWriter.WriteLine("hi");
fs.Move(originalPath, fs, FileSystemPath.Root.AppendFile("y"));
}
}
However, it exits like this:
Unhandled Exception: System.ArgumentException: The specified combination of file-systems is not supported.
at SharpFileSystem.FileSystemExtensions.Move(IFileSystem sourceFileSystem, FileSystemPath sourcePath, IFileSystem destinationFileSystem, FileSystemPath destinationPath) in C:\Users\ohnob\repos\sharpfilesystem\SharpFileSystem\FileSystemExtensions.cs:line 64
at Program.Main(String[] args) in c:\users\ohnob\onedrive\documents\visual studio 2015\Projects\sharpfilesystemPlay\sharpfilesystemPlay\Program.cs:line 14
I see that there is a PhysicalFileSystemMover and I don’t get this error if I add this line:
EntityMovers.Registration.AddLast(typeof(PhysicalFileSystem), typeof(PhysicalFileSystem), new PhysicalEntityMover());
But is this really something I should have to orchestrate manually—it feels like I’m writing boilerplate at that point? Is there a quick shortcut to loading all such available plugins, maybe using something like MEF? Could a small snippet be added to the README to demo some simple file operations to get people started in this framework?
On the other hand, I do like that this seems to be quite extensible. The pattern used by Move() is something I could use to easily add a safe, transactional Replace() without needing to alter sharpfilesystem’s code at all.
Metadata
Metadata
Assignees
Labels
No labels