=============== idCmdSystemLocal::Exec_f =============== */
| 228 | =============== |
| 229 | */ |
| 230 | void idCmdSystemLocal::Exec_f( const idCmdArgs &args ) { |
| 231 | char * f; |
| 232 | idStr filename; |
| 233 | |
| 234 | if ( args.Argc () != 2 ) { |
| 235 | common->Printf( "exec <filename> : execute a script file\n" ); |
| 236 | return; |
| 237 | } |
| 238 | |
| 239 | filename = args.Argv(1); |
| 240 | filename.DefaultFileExtension( ".cfg" ); |
| 241 | fileSystem->ReadFile( filename, reinterpret_cast<void **>(&f), NULL ); |
| 242 | if ( !f ) { |
| 243 | common->Printf( "couldn't exec %s\n", args.Argv(1) ); |
| 244 | return; |
| 245 | } |
| 246 | common->Printf( "execing %s\n", args.Argv(1) ); |
| 247 | |
| 248 | cmdSystemLocal.BufferCommandText( CMD_EXEC_INSERT, f ); |
| 249 | |
| 250 | fileSystem->FreeFile( f ); |
| 251 | } |
| 252 | |
| 253 | /* |
| 254 | =============== |