symlink?(p1)
public
Returns true if the named file is a symbolic link.
Show source
static VALUE
rb_file_symlink_p(VALUE obj, VALUE fname)
{
struct stat st;
rb_secure(2);
FilePathValue(fname);
fname = rb_str_encode_ospath(fname);
if (lstat(StringValueCStr(fname), &st) < 0) return Qfalse;
if (S_ISLNK(st.st_mode)) return Qtrue;
return Qfalse;
}