diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index c1ec498398dbb..3b1d33d137542 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -190,7 +190,11 @@ std::vector PersistentCache::LoadSkSLs() { // However, we'd like to continue visit the asset dir even if this persistent // cache is invalid. if (IsValid()) { - fml::VisitFiles(*sksl_cache_directory_, visitor); + // In case `rewinddir` doesn't work reliably, load SkSLs from a freshly + // opened directory (https://github.com/flutter/flutter/issues/65258). + fml::UniqueFD fresh_dir = + fml::OpenDirectoryReadOnly(*cache_directory_, kSkSLSubdirName); + fml::VisitFiles(fresh_dir, visitor); } std::unique_ptr mapping = nullptr;