Example: Find enclosing mount, sync

public static int main (string[] args) {
try {
File file = File.new_for_commandline_arg (args[0]);
Mount mount = file.find_enclosing_mount ();
print ("%s\n", mount.get_name ());
} catch (Error e) {
print ("Error: %s\n", e.message);
}
return 0;
}

 valac --pkg gio-2.0 GLib.File.find_enclosing_mount.vala

See:




2022 vala-language.org