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

@ -153,7 +153,6 @@ class CuraApplication(QtApplication):
if not hasattr(sys, "frozen"): if not hasattr(sys, "frozen"):
resource_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources") resource_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources")
Resources.addSearchPath(resource_path) Resources.addSearchPath(resource_path)
Resources.setBundledResourcesPath(resource_path)
self._use_gui = True self._use_gui = True
self._open_file_queue = [] # Files to open when plug-ins are loaded. self._open_file_queue = [] # Files to open when plug-ins are loaded.

View file

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