| 52 | File::~File() {} |
| 53 | |
| 54 | FileSystem* 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 | |
| 69 | File* File::Open(const std::string& file_path, const char* mode) |
| 70 | { |