symlink?()
public
Returns true if stat is a symbolic link, false if it isn’t or if
the operating system doesn’t support this feature. As File::stat
automatically follows symbolic links, symlink? will always be false for an
object returned by File::stat.
File.symlink("testfile", "alink")
File.stat("alink").symlink?
File.lstat("alink").symlink?
Show source
/*
* call-seq:
* stat.symlink? => true or false
*
* Returns <code>true</code> if <i>stat</i> is a symbolic link,
* <code>false</code> if it isn't or if the operating system doesn't
* support this feature. As <code>File::stat</code> automatically
* follows symbolic links, <code>symlink?</code> will always be
* <code>false</code> for an object returned by
* <code>File::stat</code>.
*
* File.symlink("testfile", "alink")
* File.stat("alink").symlink?
* File.lstat("alink").symlink?
*
*/
static VALUE
rb_stat_l(obj)
VALUE obj;
{
#ifdef S_ISLNK
if (S_ISLNK(get_stat(obj)->st_mode)) return Qtrue;
#endif
return Qfalse;
}