make_symbolic_link


Description:

public abstract bool make_symbolic_link (string symlink_value, Cancellable? cancellable = null) throws Error

Creates a symbolic link named this which contains the string symlink_value.

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: Create a symbolic link:

public static int main (string[] args) {
if (args.length != 3) {
print ("%s FILE LINK\n", args[0]);
return 0;
}

try {
File file = File.new_for_commandline_arg (args[2]);
file.make_symbolic_link (args[1]);
} catch (Error e) {
print ("Error: %s\n", e.message);
}
return 0;
}

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

Parameters:

this

a File with the name of the symlink to create

symlink_value

a string with the path for the target of the new symlink

cancellable

optional Cancellable object, null to ignore

Returns:

true on the creation of a new symlink, false otherwise.




2022 vala-language.org