MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Load

Method Load

neo/tools/debugger/DebuggerScript.cpp:93–120  ·  view source on GitHub ↗

================ rvDebuggerScript::Load Loads the debugger script and attempts to compile it using the method appropriate for the file being loaded. If the script cant be compiled the loading of the script fails ================ */

Source from the content-addressed store, hash-verified

91================
92*/
93bool rvDebuggerScript::Load ( const char* filename )
94{
95 void* buffer;
96 int size;
97
98 // Unload the script before reloading it
99 Unload ( );
100
101 // Cache the filename used to load the script
102 mFilename = filename;
103
104 // Read in the file
105 size = fileSystem->ReadFile ( filename, &buffer, &mModifiedTime );
106 if ( buffer == NULL )
107 {
108 return false;
109 }
110
111 // Copy the buffer over
112 mContents = new char [ size + 1 ];
113 memcpy ( mContents, buffer, size );
114 mContents[size] = 0;
115
116 // Cleanup
117 fileSystem->FreeFile ( buffer );
118
119 return true;
120}
121
122/*
123================

Callers 2

InitializeMethod · 0.45
OpenScriptMethod · 0.45

Calls 2

ReadFileMethod · 0.80
FreeFileMethod · 0.80

Tested by

no test coverage detected