Directory* GlobStreamWrapper::opendir(const String& path) { const char* prefix = "glob://"; const char* path_str = path.data(); int path_len = path.length(); // only accept paths with the glob:// prefix if (strncmp(path_str, prefix, strlen(prefix)) != 0) { return nullptr; } path_str += strlen(prefix); path_len -= strlen(prefix); auto glob = f_glob(String(path_str, path_len, CopyString)); if (!glob.isArray()) { return nullptr; } return NEWOBJ(ArrayDirectory)(glob.toArray()); }
bool TestExtFile::test_glob() { f_touch("test/test_ext_file.tmp"); VS(f_glob("test/test_*_file.tmp"), CREATE_VECTOR1("test/test_ext_file.tmp")); return Count(true); }