-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi There!
I have implemented a function to deserialize a filesystem created with Serialize...
// deserialize show file
bool LoadFileSystem(std::string FileName = "")
{
if (FileName.size() == 0)
FileName = "last.fs";
ifstream in(FileName, ios::in | ios::binary);
if (in.is_open())
{
in.seekg(0, std::ios::end);
std::streampos length = in.tellg();
in.seekg(0, std::ios::beg);
std::vector<char> buffer(length);
in.read(&buffer[0], length);
in.close();
try
{
g_VFS.Deserialize(buffer);
}
catch (VFS::CVFSException e)
{
// spdlog::error("Failed to deserialize: '{}' -> {}",FileName, e.what());
return false;
}
return true;
}
// spdlog::error("Could not open file: {}", FileName);
return false;
}
This is working, but say create some default directories, eg "/sys", I save the file system, then load a file system, I have now in PrintDirs two "/sys" folders.
Is there a simple way to merge or overlay these?
Also is there a better way to load, so I don't load the entire thing into memory here when loading? I couldn't really think of one.
Cheers,
Metadata
Metadata
Assignees
Labels
No labels