Search for bundled packages file in all search paths

For this we need to rename bundled_packages to disambiguate between that and the other packages.json file for user-installed packages.

Contributes to issue CURA-5364.
This commit is contained in:
Ghostkeeper 2018-05-15 11:13:59 +02:00
parent fccfff14bc
commit 0a9f389396
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
3 changed files with 8 additions and 10 deletions

View file

@ -28,15 +28,14 @@ class CuraPackageManager(QObject):
self._container_registry = self._application.getContainerRegistry()
self._plugin_registry = self._application.getPluginRegistry()
# JSON file that keeps track of all installed packages.
self._bundled_package_management_file_path = os.path.join(
os.path.abspath(Resources.getBundledResourcesPath()),
"packages.json"
)
self._user_package_management_file_path = os.path.join(
os.path.abspath(Resources.getDataStoragePath()),
"packages.json"
)
#JSON files that keep track of all installed packages.
for search_path in Resources.getSearchPaths():
candidate_bundled_path = os.path.join(search_path, "bundled_packages.json")
if os.path.exists(candidate_bundled_path):
self._bundled_package_management_file_path = candidate_bundled_path
candidate_user_path = os.path.join(search_path, "packages.json")
if os.path.exists(candidate_user_path):
self._user_package_management_file_path = candidate_user_path
self._bundled_package_dict = {} # A dict of all bundled packages
self._installed_package_dict = {} # A dict of all installed packages