Changeset 505 for trunk/src/engine/program_manager.cc
- Timestamp:
- 07/12/16 20:22:23 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/program_manager.cc
r501 r505 45 45 } 46 46 47 nv::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 47 59 nv::string_buffer nv::program_manager::load_source( lua::table_guard& table, const string_view& append ) 48 60 { … … 51 63 if ( table.is_string( "files" ) ) 52 64 { 53 out.append( f s.slurp( table.get_string( "files" ) ) );65 out.append( file_to_string( table.get_string( "files" ) ) ); 54 66 } 55 67 else if ( table.is_table( "files" ) ) … … 61 73 const_string include( inctable.get<const_string,uint32>(i) ); 62 74 if ( i == count ) out.append( "#line 1\n" ); 63 out.append( f s.slurp( include ) );75 out.append( file_to_string( include ) ); 64 76 } 65 77 } … … 67 79 if ( table.is_string( "file" ) ) 68 80 { 69 const_string data = f s.slurp( table.get_string( "file" ) );81 const_string data = file_to_string( table.get_string( "file" ) ); 70 82 out.append( "#line 1\n" + data ); 71 83 }
Note: See TracChangeset
for help on using the changeset viewer.