citadel-realms/js/model/Utils.js

15 lines
428 B
JavaScript
Raw Permalink Normal View History

2024-11-12 17:12:37 -05:00
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;
}