symlink(p1, p2)
public
Creates a symbolic link called
new_name for the existing file old_name. Raises a
NotImplemented exception on platforms that do not support symbolic
links.
File.symlink("testfile", "link2test")
Show source
/*
* call-seq:
* File.symlink(old_name, new_name) => 0
*
* Creates a symbolic link called <i>new_name</i> for the existing file
* <i>old_name</i>. Raises a <code>NotImplemented</code> exception on
* platforms that do not support symbolic links.
*
* File.symlink("testfile", "link2test")
*
*/
static VALUE
rb_file_s_symlink(klass, from, to)
VALUE klass, from, to;
{
#ifdef HAVE_SYMLINK
SafeStringValue(from);
SafeStringValue(to);
if (symlink(StringValueCStr(from), StringValueCStr(to)) < 0) {
sys_fail2(from, to);
}
return INT2FIX(0);
#else
rb_notimplement();
return Qnil; /* not reached */
#endif
}