method
symlink?
v1_9_2_180 -
Show latest stable
- Class:
File
symlink?(p1)public
Returns true if the named file is a symbolic link.
static VALUE
rb_file_symlink_p(VALUE obj, VALUE fname)
{
#ifndef S_ISLNK
# ifdef _S_ISLNK
# define S_ISLNK(m) _S_ISLNK(m)
# else
# ifdef _S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
# endif
# endif
# endif
#endif
#ifdef S_ISLNK
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;
#endif
return Qfalse;
} Related methods
- Instance methods
- atime
- chmod
- chown
- ctime
- flock
- lstat
- mtime
- path
- size
- to_path
- truncate
- Class methods
- absolute_path
- atime
- basename
- blockdev?
- chardev?
- chmod
- chown
- ctime
- delete
- directory?
- dirname
- executable?
- executable_real?
- exist?
- exists?
- expand_path
- extname
- file?
- fnmatch
- fnmatch?
- ftype
- grpowned?
- identical?
- join
- lchmod
- lchown
- link
- lstat
- mtime
- new
- open
- owned?
- path
- pipe?
- readable?
- readable_real?
- readlink
- realdirpath
- realpath
- rename
- setgid?
- setuid?
- size
- size?
- socket?
- split
- stat
- sticky?
- symlink
- symlink?
- truncate
- umask
- unlink
- utime
- world_readable?
- world_writable?
- writable?
- writable_real?
- zero?