Throws FileStream
Add functions such as try_open(), try_fdopen() like this
[CCode (cname = "g_fopen", cheader_filename = "glib/gstdio.h")]
public static FileStream? open (string path, string mode);
[CCode (cname = "fdopen")]
public static FileStream? fdopen (int fildes, string mode);
public static FileStream? try_open (string path, string mode) throws GLib.FileError {
FileStream fs = open(path, mode);
if (fs == null || fs.error () != 0) {
throw new FileError.ACCES ("Can't acces to file");
}
return fs;
}
public static FileStream? try_fdopen (int fildes, string mode) throws GLib.FileError {
FileStream fs = fdopen(fildes, mode);
if (fs == null || fs.error () != 0) {
throw new FileError.ACCES ("Can't acces to file");
}
return fs;
}
and do it on all the other functions, do you think it's a good idea? if it's enough I can carry on