[VictoriaFalls] Split the path when opening a file.

This commit is contained in:
Drew Galbraith 2023-11-02 20:24:33 -07:00
parent a2e80952c8
commit abf09d8fce
1 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#include "victoriafalls_server.h"
#include <glacier/string/str_split.h>
#include <mammoth/debug.h>
#include <zcall.h>
glcr::ErrorOr<glcr::UniquePtr<VFSServer>> VFSServer::Create() {
@ -8,7 +10,16 @@ glcr::ErrorOr<glcr::UniquePtr<VFSServer>> VFSServer::Create() {
return glcr::UniquePtr<VFSServer>(new VFSServer(endpoint_cap));
}
glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest&,
glcr::ErrorCode VFSServer::HandleOpenFile(const OpenFileRequest& request,
OpenFileResponse&) {
auto path_tokens = glcr::StrSplit(request.path(), '/');
for (uint64_t i = 0; i < path_tokens.size(); i++) {
dbgln("Token %u: '%s'", i, glcr::String(path_tokens.at(i)).cstr());
}
// Require all paths to be absolute rather than relative.
// If the path starts with '/' then the first token will be empty.
if (path_tokens.at(0) != "") {
return glcr::INVALID_ARGUMENT;
}
return glcr::UNIMPLEMENTED;
}