I have managed to read the content of a file from the disk with this snippet:
const { Gio } = imports.gi;
class Indicator extends PanelMenu.Button {
_init() {
const file = Gio.File.new_for_uri(
'file:.config/wireguard/current_vpn');
const [, contents, etag] = this._file.load_contents(null);
const decoder = new TextDecoder('utf-8');
const contentsString = decoder.decode(contents);
}
}
Now I am tryning to list all the *.conf
files from a directory. But I cannot find a proper way to do that reading the Gio docs