find_enclosing_mount
Description:
Mount is returned only for user interesting locations, see
VolumeMonitor. If the File
for this does not have a mount
, throws will be set to
g_io_error_not_found and null will
be returned.
If cancellable
is not null, then the operation can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error g_io_error_cancelled will be returned.
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
Parameters:
this |
input File |
cancellable |
optional Cancellable object, null to ignore |
Returns:
a Mount where the this is located or null on error. Free the returned object with unref. |