Commit db9ef11f authored by Florian Müllner's avatar Florian Müllner Committed by verdre

extensionSystem: Install pending updates on startup

Now that we have a way to check for updates and download them, we
should actually apply them as well. Do this on startup before any
extensions are initialized, to make sure we don't run into any
conflicts with a previously loaded version.

!945
parent ea5732fe
Pipeline #147635 passed with stages
in 5 minutes and 20 seconds
This commit is part of merge request !945. Comments created here will be created in the context of that merge request.
......@@ -45,6 +45,7 @@ var ExtensionManager = class {
return GLib.SOURCE_REMOVE;
});
this._installExtensionUpdates();
this._sessionUpdated();
}
......@@ -456,6 +457,21 @@ var ExtensionManager = class {
}).forEach(extension => this.reloadExtension(extension));
}
_installExtensionUpdates() {
FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => {
let fileType = info.get_file_type();
if (fileType !== Gio.FileType.DIRECTORY)
return;
let uuid = info.get_name();
let extensionDir = Gio.File.new_for_path(
GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
FileUtils.recursivelyDeleteDir(extensionDir, false);
FileUtils.recursivelyMoveDir(dir, extensionDir);
FileUtils.recursivelyDeleteDir(dir, true);
});
}
_loadExtensions() {
global.settings.connect(`changed::${ENABLED_EXTENSIONS_KEY}`,
this._onEnabledExtensionsChanged.bind(this));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment