new_for_uri
Description:
Constructs a File for a given URI.
This operation never fails, but the returned object might not support any I/O operation if uri
is malformed or if the uri type is
not supported.
Example: Construct a File for a given URI:
public static int main (string[] args) {
if (args.length != 2) {
// example: ./binary file://localhost/home/myname
print ("%s URIy\n", args[0]);
return 0;
}
File file = File.new_for_uri (args[1]);
for (File pos = file; pos != null; pos = pos.get_parent ()) {
print ("%s\n", pos.get_path ());
}
return 0;
}
valac --pkg gio-2.0 GLib.File.new_for_uri.vala
Parameters:
uri |
a UTF-8 string containing a URI |
Returns:
a new File for the given |