I have been looking into libraries for a file system that will allow path mounting on purely an application level. This may not be called just “path mounting” since that has the connotation of os level path mounting, but something else, I am not sure of the terminology. I was hoping to be able to find a few but were unable to find anything to what I am looking for (boost::filesystem was the closest I found). I wanted to be able to compare several different libraries in hopes of seeing what advantages and disadvantages they have.
What I mean by a file system with path mounting is so I would have a path such as
"SomeRoot:data\file.txt"
and the "SomeRoot" would be replaced with C:\SomeFolder", which would be set to the file mount system.
Does anyone know of a file system that will allow path mounting?
Edit:
Since it appears that there may not be many libraries for this, I would also be interested in how to construct one properly.
If you are looking for an “application level file system” then at the most basic level, you are going to need to do a string replace. On the most basic level there are two strings
MountPointWhich will be used as the “mount point”, such as your
SomeRoot.MountResolveWhich is the location to what
mount pointis pointed at for when “resolving” a file location. This is the same as yourC:\SomeFolder.Besides for the obvious accessor and getters for those variables, there is the need for a function to resolve the path, which is this case can be
bool ResolvePath(const String& mountPath, String& resolvedPath);The contents of the
ResolvePathare very simple, all you need to do is replace the currentMountPointstring inmountPathand place the result intoresolvedPath.However, there is more that can be done in that function. The reason why I have it returning a bool is because the function should fail
mountPathdoes not have theMountPoint. To check, just do a simplestring::find.With this, you can now resolve
SomeRoot:data\file.txttoC:\SomeFolder\data\file.txtif MountResolve is set toC:\SomeFolder\. However, you mentioned without the trailing slash at the end. Since there is nothing to be currently done to verify that slash, your result would beC:\SomeFolderdata\file.txt. This is wrong.On your access for setting the mount resolve, you want to check to see if there is there is a trailing folder slash. If there is not, then add it.
This will allow a basic “FileSystem” class to have one MountPoint/MountResolve. It will not be very difficult to extend this to allow multiple mount points either.