citadel-realms/js/model/Utils.js
2024-11-12 17:26:26 -05:00

15 lines
428 B
JavaScript

import Gio from 'gi://Gio';
export function loadInterfaceXML(iface) {
let uri = `resource:///com/subgraph/citadel/Realms/dbus-interfaces/${iface}.xml`;
let f = Gio.File.new_for_uri(uri);
try {
let [_ok, bytes] = f.load_contents(null);
// @ts-ignore
return new TextDecoder().decode(bytes);
}
catch (e) {
log(`Failed to load D-Bus interface ${iface}`);
}
return null;
}