Hot to parse .ini file in extension



Hi all,

I am developing a little extension for Gnome Shell and I need to read and parse an .ini file from my system.

I find a GLib object (GKeyFile) that would be suitable for this, but I cannot find doc, code, example on how to use it in shell.

With the code below:

const GLib = imports.gi.GLib;
let kf = new GLib.KeyFile();

I obtain the following error:

JS ERROR: !!! Exception was: Error: Unable to construct boxed type KeyFile since it has no zero-args <constructor>, can only wrap an existing one
    JS ERROR: !!!     lineNumber = '0'
    JS ERROR: !!!     fileName = '"gjs_throw"'
JS ERROR: !!! stack = '"("Unable to construct boxed type KeyFile since it has no zero-args <constructor>, can only wrap an existing one")@gjs_throw:0 test js:12"' JS ERROR: !!! message = '"Unable to construct boxed type KeyFile since it has no zero-args <constructor>, can only wrap an existing one"' Error: Unable to construct boxed type KeyFile since it has no zero-args <constructor>, can only wrap an existing one

Can you help me?

Thanks,
    Stefano C.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]