MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / FolderExists

Method FolderExists

tensorflow/core/platform/cloud/gcs_file_system.cc:1307–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1305}
1306
1307Status 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
1335Status GcsFileSystem::GetChildren(const string& dirname,
1336 std::vector<string>* result) {

Callers

nothing calls this directly

Calls 5

InvalidArgumentFunction · 0.85
MaybeAppendSlashFunction · 0.85
LookupOrComputeMethod · 0.80
emptyMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected