Directory listing with Glib

I want to build some local files list for navigation in the browser window.

I can do that with native language API, but maybe some Glib/Gio abstractions exist? I found how to open the file asynchronously and handle its content, just not sure about the directory list, because it’s also the file in Linux fylesystems:

File::for_uri(&uri.to_string()).load_contents_async(Some(&cancellable), |result| {
    match result {
        Ok(_) => todo!(),
        Err(_) => todo!(),
    }
});

In other words, I’m looking for some is_dir / is_file methods on the first step, or just reference where can I start. Seems this class provides everything I want, but not sure yet:

Just found this method:

Seems File class provides me everything I want for this task.

And about is_dir / is_file:

  • also, enumerate_children includes FileInfo with file_type method in response

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.