Ignore:
Timestamp:
07/12/16 20:22:23 (9 years ago)
Author:
epyon
Message:
  • several STL updates
  • several minor fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine/program_manager.cc

    r501 r505  
    4545}
    4646
     47nv::const_string nv::program_manager::file_to_string( const string_view& path )
     48{
     49        c_file_system fs;
     50        stream* fstream = open_stream( fs, path );
     51        if ( !fstream ) return const_string();
     52        uint32 size = fstream->size();
     53        const_string result( nullptr, size );
     54        fstream->read( const_cast<char*>( result.data() ), size, 1 );
     55        delete fstream;
     56        return result;
     57}
     58
    4759nv::string_buffer nv::program_manager::load_source( lua::table_guard& table, const string_view& append )
    4860{
     
    5163        if ( table.is_string( "files" ) )
    5264        {
    53                 out.append( fs.slurp( table.get_string( "files" ) ) );
     65                out.append( file_to_string( table.get_string( "files" ) ) );
    5466        }
    5567        else if ( table.is_table( "files" ) )
     
    6173                        const_string include( inctable.get<const_string,uint32>(i) );
    6274                        if ( i == count ) out.append( "#line 1\n" );
    63                         out.append( fs.slurp( include ) );
     75                        out.append( file_to_string( include ) );
    6476                }
    6577        }
     
    6779        if ( table.is_string( "file" ) )
    6880        {
    69                 const_string data = fs.slurp( table.get_string( "file" ) );
     81                const_string data = file_to_string( table.get_string( "file" ) );
    7082                out.append( "#line 1\n" + data );
    7183        }
Note: See TracChangeset for help on using the changeset viewer.