static public Method

File.symlink(p1, p2)

File.symlink(old_name, new_name)    0

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")   #=> 0

Source Code

/*
*  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")   #=> 0
*     
*/

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
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.