CURA-5296 fix first startup not loading bundled packages

This commit is contained in:
Jack Ha 2018-05-09 13:18:02 +02:00
parent 7ac7f91d5d
commit 45fc8480a1

View file

@ -54,9 +54,16 @@ class CuraPackageManager(QObject):
# (for initialize) Loads the package management file if exists
def _loadManagementData(self) -> None:
# The bundles package management file should always be there
if not os.path.exists(self._bundled_package_management_file_path):
Logger.log("w", "Bundled package management file could not be found!")
return
# Load the bundled packages:
with open(self._bundled_package_management_file_path, "r", encoding = "utf-8") as f:
self._bundled_package_dict = json.load(f, encoding = "utf-8")
Logger.log("i", "Loaded bundled packages data from %s", self._bundled_package_management_file_path)
# Load the user package management file
if not os.path.exists(self._user_package_management_file_path):
Logger.log("i", "User package management file %s doesn't exist, do nothing", self._user_package_management_file_path)
return
@ -65,11 +72,6 @@ class CuraPackageManager(QObject):
container_registry = self._application.getContainerRegistry()
with container_registry.lockFile():
# Load the bundled packages:
with open(self._bundled_package_management_file_path, "r", encoding = "utf-8") as f:
self._bundled_package_dict = json.load(f, encoding = "utf-8")
Logger.log("i", "Loaded bundled packages data from %s", self._bundled_package_management_file_path)
# Load the user packages:
with open(self._user_package_management_file_path, "r", encoding="utf-8") as f:
management_dict = json.load(f, encoding="utf-8")