diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-07-27 19:35:22 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-07-27 19:35:22 -0300 |
commit | 770aa6798461cc3467d3a47946cf30358e495745 (patch) | |
tree | c28eda7cd0ebcf22a563d5840b2bd3d587f97335 | |
parent | 8eeb395a73a9a3c18b9c7659eedd5cf3927257d2 (diff) | |
download | finder-770aa6798461cc3467d3a47946cf30358e495745.tar.gz finder-770aa6798461cc3467d3a47946cf30358e495745.tar.bz2 |
Fix: plugin: opener: searcher: minor fixes; feat: adds force parameter
-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' ] |