MCPcopy Create free account
hub / github.com/chen3feng/toft / GetFileSystemByPath

Method GetFileSystemByPath

storage/file/file.cpp:54–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52File::~File() {}
53
54FileSystem* File::GetFileSystemByPath(const std::string& file_path)
55{
56 // "/mfs/abc" -> "mfs"
57 if (file_path[0] == '/') {
58 size_t next_slash = file_path.find('/', 1);
59 if (next_slash != std::string::npos) {
60 std::string prefix = file_path.substr(1, next_slash - 1);
61 FileSystem* fs = TOFT_GET_FILE_SYSTEM(prefix);
62 if (fs != NULL)
63 return fs;
64 }
65 }
66 return TOFT_GET_FILE_SYSTEM("local");
67}
68
69File* File::Open(const std::string& file_path, const char* mode)
70{

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
substrMethod · 0.80

Tested by

no test coverage detected