better file handling in shell

This commit is contained in:
Eliot Horowitz
2009-08-14 11:06:10 -04:00
parent 974d710128
commit 115e9e42e1
2 changed files with 13 additions and 2 deletions

View File

@@ -33,10 +33,17 @@ namespace mongo {
assert( 0 );
return false;
}
if ( ! exists( p ) ){
cerr << "file [" << filename << "] doesn't exist" << endl;
if ( assertOnError )
assert( 0 );
return false;
}
File f;
f.open( filename.c_str() );
fileofs L = f.len();
assert( L <= 0x7ffffffe );
char * data = (char*)malloc( (size_t) L+1 );