new_for_path
Description:
Constructs a File for a given path.
This operation never fails, but the returned object might not support any I/O operation if path
is malformed.
Example: Construct a File for a given path:
public static int main (string[] args) {
// Create a file that can only be accessed by the current user:
File file = File.new_for_path ("my-test.txt");
try {
FileOutputStream os = file.create (FileCreateFlags.PRIVATE);
os.write ("My first line\n".data);
print ("Created.\n");
} catch (Error e) {
print ("Error: %s\n", e.message);
}
return 0;
}
valac --pkg gio-2.0 GLib.File.new_for_path.vala
Parameters:
path |
a string containing a relative or absolute path. The string must be encoded in the glib filename encoding. |
Returns:
a new File for the given |