diff options
-rw-r--r-- | packages/finder/plugin/searcher/file/name.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/packages/finder/plugin/searcher/file/name.py b/packages/finder/plugin/searcher/file/name.py index 0a9567c..b6319fe 100644 --- a/packages/finder/plugin/searcher/file/name.py +++ b/packages/finder/plugin/searcher/file/name.py @@ -42,9 +42,9 @@ class FinderPluginFileNameSearcher(): self.path = path self.cache = os.path.join(cache_dir, 'plugin', 'searcher', 'file', os.path.abspath(self.path).replace(os.sep, '_') + '.json') - async def finder(self): + async def finder(self, force = False): # Check existing cache - if os.path.exists(self.cache) and os.path.isfile(self.cache): + if not force and os.path.exists(self.cache) and os.path.isfile(self.cache): with open(self.cache, 'r') as f: self.items = json.load(f) @@ -55,7 +55,7 @@ class FinderPluginFileNameSearcher(): return self.items # Update the folder list - self.walker() + await self.walker() # Update the cache os.makedirs(os.path.dirname(self.cache), exist_ok=True) @@ -70,9 +70,6 @@ class FinderPluginFileNameSearcher(): return filter(lambda s: re.search(re.escape(text), s, flags=re.IGNORECASE), self.items) - def has_cache(self): - pass - async def walker(self): ignore_folders = [ '.git', '__pycache__' ] ignore_files = [ '.gitignore', '.gitattributes', '.gitmodules' ] |