mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
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
1 changed files with 3 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue