Class Kgio::File
In: ext/kgio/accept.c  (CVS)
Parent: File

This subclass of the core File class adds the "tryopen" singleton method for opening files. A single "tryopen" and check for the return value may be used to avoid unnecessary stat(2) syscalls or File.open exceptions when checking for the existence of a file and opening it.

Methods

tryopen  

Included Modules

mPipeMethods

External Aliases

path -> to_path

Public Class methods

     Kgio::File.tryopen(filename, [, mode [, perm]])      -> Kgio::File or Symbol

Returns a Kgio::File object on a successful open. filename is a path to any file on the filesystem. If specified, mode is a bitmask of flags (see IO.sysopen) and perm should be an octal number.

This does not raise errors for most failures, but installs returns a Ruby symbol for the constant in the Errno::* namespace.

Common error symbols are:

  • :ENOENT
  • :EACCES

See your open(2) manpage for more information on open(2) errors.

[Validate]