Skip to content

Commit

Permalink
Add-on store: only make directories if should write to disk (#14968)
Browse files Browse the repository at this point in the history
Fix up of #14955
Raised in #14912 (comment)

Summary of the issue:
Caching directories are still created when NVDA should not write to disk

Description of user facing changes
Caching directories are no longer created when NVDA should not write to disk

Description of development approach
Caching directories are no longer created when NVDA should not write to disk
  • Loading branch information
seanbudd committed Jun 6, 2023
1 parent eee4939 commit 7b91697
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/_addonStore/dataManager.py
Expand Up @@ -76,10 +76,12 @@ def __init__(self):
self._cacheCompatibleFile = os.path.join(cacheDirLocation, _DataManager._cacheCompatibleFilename)
self._addonDownloadCacheDir = os.path.join(cacheDirLocation, "_dl")
self._installedAddonDataCacheDir = os.path.join(cacheDirLocation, "addons")
# ensure caching dirs exist
pathlib.Path(cacheDirLocation).mkdir(parents=True, exist_ok=True)
pathlib.Path(self._addonDownloadCacheDir).mkdir(parents=True, exist_ok=True)
pathlib.Path(self._installedAddonDataCacheDir).mkdir(parents=True, exist_ok=True)

if NVDAState.shouldWriteToDisk():
# ensure caching dirs exist
pathlib.Path(cacheDirLocation).mkdir(parents=True, exist_ok=True)
pathlib.Path(self._addonDownloadCacheDir).mkdir(parents=True, exist_ok=True)
pathlib.Path(self._installedAddonDataCacheDir).mkdir(parents=True, exist_ok=True)

self._latestAddonCache = self._getCachedAddonData(self._cacheLatestFile)
self._compatibleAddonCache = self._getCachedAddonData(self._cacheCompatibleFile)
Expand Down

0 comments on commit 7b91697

Please sign in to comment.