| 1305 | } |
| 1306 | |
| 1307 | Status GcsFileSystem::FolderExists(const string& dirname, bool* result) { |
| 1308 | StatCache::ComputeFunc compute_func = [this](const string& dirname, |
| 1309 | GcsFileStat* stat) { |
| 1310 | std::vector<string> children; |
| 1311 | TF_RETURN_IF_ERROR( |
| 1312 | GetChildrenBounded(dirname, 1, &children, true /* recursively */, |
| 1313 | true /* include_self_directory_marker */)); |
| 1314 | if (!children.empty()) { |
| 1315 | stat->base = DIRECTORY_STAT; |
| 1316 | return Status::OK(); |
| 1317 | } else { |
| 1318 | return errors::InvalidArgument("Not a directory!"); |
| 1319 | } |
| 1320 | }; |
| 1321 | GcsFileStat stat; |
| 1322 | Status s = stat_cache_->LookupOrCompute(MaybeAppendSlash(dirname), &stat, |
| 1323 | compute_func); |
| 1324 | if (s.ok()) { |
| 1325 | *result = stat.base.is_directory; |
| 1326 | return Status::OK(); |
| 1327 | } |
| 1328 | if (errors::IsInvalidArgument(s)) { |
| 1329 | *result = false; |
| 1330 | return Status::OK(); |
| 1331 | } |
| 1332 | return s; |
| 1333 | } |
| 1334 | |
| 1335 | Status GcsFileSystem::GetChildren(const string& dirname, |
| 1336 | std::vector<string>* result) { |
nothing calls this directly
no test coverage detected