Ejemplo n.º 1
0
        public static int SysOpen(RubyClass /*!*/ self, [NotNull] MutableString path, [Optional] MutableString mode, [Optional] int perm)
        {
            if (RubyFileOps.DirectoryExists(self.Context, path))
            {
                // TODO: What file descriptor should be returned for a directory?
                return(-1);
            }
            RubyIO io       = new RubyFile(self.Context, path.ToString(), IOModeEnum.Parse(mode));
            int    fileDesc = io.GetFileDescriptor();

            io.Close();
            return(fileDesc);
        }
Ejemplo n.º 2
0
 public static bool Exists(RubyModule /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ path)
 {
     return(RubyFileOps.FileExists(self.Context, path) || RubyFileOps.DirectoryExists(self.Context, path));
 }
Ejemplo n.º 3
0
 public static bool Exists(ConversionStorage <MutableString> /*!*/ toPath, RubyModule /*!*/ self, object path)
 {
     return(RubyFileOps.DirectoryExists(self.Context, Protocols.CastToPath(toPath, path)));
 }