From 770aa6798461cc3467d3a47946cf30358e495745 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 27 Jul 2024 19:35:22 -0300 Subject: Fix: plugin: opener: searcher: minor fixes; feat: adds force parameter --- packages/finder/plugin/searcher/file/name.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'packages') 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' ] -- cgit v1.2.3