// Check if the specified directory exists // Warning: if 'path' has a trailing '/' or '\\' character, it will be removed! bool MassStorage::DirectoryExists(const StringRef& path) const { // Remove any trailing '/' from the directory name, it sometimes (but not always) confuses f_opendir const size_t len = path.strlen(); if (len != 0 && (path[len - 1] == '/' || path[len - 1] == '\\')) { path.Truncate(len - 1); } DIR dir; const bool ok = (f_opendir(&dir, path.c_str()) == FR_OK); if (ok) { f_closedir(&dir); } return ok; }
void NetworkTransaction::Write(StringRef ref) { Write(ref.Pointer(), ref.strlen()); }