Method: File.writable?

Defined in:
file.c

.writable?(file_name) ⇒ Boolean

Returns true if the named file is writable by the effective user and group id of this process. See eaccess(3).

Note that some OS-level security features may cause this to return true even though the file is not writable by the effective user/group.

Returns:

  • (Boolean)


1868
1869
1870
1871
1872
1873
# File 'file.c', line 1868

static VALUE
rb_file_writable_p(VALUE obj, VALUE fname)
{
    if (rb_eaccess(fname, W_OK) < 0) return Qfalse;
    return Qtrue;
}