MCPcopy Create free account
hub / github.com/PDAL/PDAL / remoteGlob

Function remoteGlob

pdal/PDALUtils.cpp:540–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538
539
540std::vector<std::string> remoteGlob(const std::string& path)
541{
542 // Arbiter::resolve() globs for * or ** only if they are at the end of
543 // a path. To pattern match file endings, we need to split the string
544 // so it ends in *, then filter the results later.
545 std::string::size_type pos = path.find_last_of('*');
546 std::string suffix;
547 if (pos != std::string::npos)
548 suffix = path.substr(pos + 1);
549
550 arbiter::Arbiter a;
551 // If it has a suffix, resolve a substring that ends at the final wildcard
552 if (suffix.size())
553 {
554 StringList globResult = a.resolve(path.substr(0, pos + 1));
555 StringList filtered;
556 // filter for the suffix
557 for (auto p : globResult)
558 if (Utils::endsWith(p, suffix))
559 filtered.push_back(p);
560
561 return filtered;
562 }
563 else
564 return a.resolve(path);
565}
566
567
568// Glob remote or local filepaths. Remote paths only support '*' or '**'

Callers 1

globFunction · 0.85

Calls 2

endsWithFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected