extensionSystem: Include dir and path in data passed to extension
Extensions often need to set up additional resources from their directory, like settings, translations or image assets. So far extensions have used getCurrentExtension() to access the shell's internal extension object which contains path and dir properties. That's far from ideal, first because it requires generating a stack to figure out the current extension, and second because the internal object also contains state that extensions shouldn't meddle with. Just include those properties in the metadata we pass to the extension constructor. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2838>
This commit is contained in:
parent
63c3f3e7be
commit
1c98a95974
@ -536,7 +536,9 @@ var ExtensionManager = class extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
try {
|
||||
extensionState = new extensionModule.default(extension.metadata);
|
||||
const {metadata, path} = extension;
|
||||
extensionState =
|
||||
new extensionModule.default({...metadata, dir, path});
|
||||
} catch (e) {
|
||||
this.logExtensionError(uuid, e);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user