aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/finder/plugin/searcher/file/name.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/finder/plugin/searcher/file/name.py b/packages/finder/plugin/searcher/file/name.py
index caf2a63..0a9567c 100644
--- a/packages/finder/plugin/searcher/file/name.py
+++ b/packages/finder/plugin/searcher/file/name.py
@@ -21,8 +21,8 @@
import os
import re
import json
+import asyncio
-from threading import Thread
from platformdirs import user_cache_dir
class FinderPluginFileNameSearcher():
@@ -49,7 +49,8 @@ class FinderPluginFileNameSearcher():
self.items = json.load(f)
# Then update the folder list in the background
- walker = Thread(target=self.walker, name='Walker for ' + self.path)
+ async with asyncio.TaskGroup() as tg:
+ walker = tg.create_task(self.walker())
return self.items
@@ -72,9 +73,10 @@ class FinderPluginFileNameSearcher():
def has_cache(self):
pass
- def walker(self):
+ async def walker(self):
ignore_folders = [ '.git', '__pycache__' ]
ignore_files = [ '.gitignore', '.gitattributes', '.gitmodules' ]
+ items = []
for parent, dirs, files in os.walk(self.path):
# Do not traverse some folders
@@ -101,4 +103,6 @@ class FinderPluginFileNameSearcher():
if file.startswith('.'):
continue
- self.items.append(os.path.join(parent, file))
+ items.append(os.path.join(parent, file))
+
+ self.items = items