Exemplo n.º 1
0
        //typedef std::unique_ptr<core_file> ptr;


        // ----- file open/close -----

        // open a file with the specified filename
        public static osd_file.error open(string filename, uint32_t openflags, out core_file file)
        {
            file = null;

            //try
            {
                // attempt to open the file
                osd_file f;
                UInt64   length = 0;
                var      filerr = osdcore_global.m_osdfile.open(filename, openflags, out f, out length);
                if (filerr != osd_file.error.NONE)
                {
                    return(filerr);
                }

                file = new core_osd_file(openflags, f, length);
                return(osd_file.error.NONE);
            }
Exemplo n.º 2
0
            //typedef std::unique_ptr<core_file> ptr;


            // ----- file open/close -----

            // open a file with the specified filename
            public static std.error_condition open(string filename, uint32_t openflags, out core_file file)
            {
                file = null;

                // attempt to open the file
                osd_file f;
                uint64_t length = 0;
                var      filerr = m_osdfile.open(filename, openflags, out f, out length); // FIXME: allow osd_file to accept std::string_view

                if (filerr)
                {
                    return(filerr);
                }

                try { file = new core_osd_file(openflags, f, length); }
                catch (Exception) { return(std.errc.not_enough_memory); }

                return(new std.error_condition());
            }