Skip to content

Commit f694f82

Browse files
U-ELIOT-019992DFC\AdministratorU-ELIOT-019992DFC\Administrator
authored andcommitted
windows fix for finding jars
1 parent 1515ab7 commit f694f82

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

db/javajs.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -565,16 +565,27 @@ namespace mongo {
565565
if ( ! possible.size() ) {
566566
possible.push_back( "./" );
567567
possible.push_back( "../" );
568-
568+
569569
log(2) << "dbExecCommand: " << dbExecCommand << endl;
570-
if ( dbExecCommand.find( "/" ) != std::string::npos ){
571-
string dbDir = dbExecCommand.substr( 0 , dbExecCommand.find_last_of( "/" ) );
572-
log(2) << "dbDir [" << dbDir << "]" << endl;
573-
possible.push_back( ( dbDir + "/../lib/mongo/" ));
574-
possible.push_back( ( dbDir + "/../lib64/mongo/" ));
575-
possible.push_back( ( dbDir + "/../lib32/mongo/" ));
576-
}
577570

571+
string dbDir = dbExecCommand;
572+
#ifdef WIN32
573+
if ( dbDir.find( "\\" ) != string::npos ){
574+
dbDir = dbDir.substr( 0 , dbDir.find_last_of( "\\" ) );
575+
}
576+
#else
577+
if ( dbDir.find( "/" ) != string::npos ){
578+
dbDir = dbDir.substr( 0 , dbDir.find_last_of( "/" ) );
579+
}
580+
#endif
581+
else {
582+
dbDir = ".";
583+
}
584+
585+
log(2) << "dbDir [" << dbDir << "]" << endl;
586+
possible.push_back( ( dbDir + "/../lib/mongo/" ));
587+
possible.push_back( ( dbDir + "/../lib64/mongo/" ));
588+
possible.push_back( ( dbDir + "/../lib32/mongo/" ));
578589
}
579590

580591
for ( list<string>::iterator i = possible.begin() ; i != possible.end(); i++ ) {

0 commit comments

Comments
 (0)