MCPcopy Index your code
hub / github.com/geekcomputers/Python / build_application_index

Function build_application_index

JARVIS/apps.py:39–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39def build_application_index():
40 apps = {}
41 for root in safe_search_dirs():
42 try:
43 candidates = list(root.rglob("*.lnk"))
44 if root.name.lower() in {"program files", "program files (x86)", "programs"}:
45 candidates.extend(root.glob("*/*.exe"))
46 candidates.extend(root.glob("*.exe"))
47 except OSError:
48 continue
49 for path in candidates:
50 if not is_safe_app_path(path):
51 continue
52 name = app_name_from_path(path)
53 key = normalize_text(name)
54 apps.setdefault(key, {"name": name, "path": str(path)})
55 sorted_apps = sorted(apps.values(), key=lambda item: item["name"].lower())
56 APP_INDEX_FILE.write_text(json.dumps(sorted_apps, ensure_ascii=False, indent=2), encoding="utf-8")
57 return sorted_apps
58
59
60def load_application_index(refresh=False):

Callers 3

voice_loopFunction · 0.85
typed_loopFunction · 0.85
load_application_indexFunction · 0.85

Calls 5

safe_search_dirsFunction · 0.85
is_safe_app_pathFunction · 0.85
app_name_from_pathFunction · 0.85
normalize_textFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected