diff options
author | U-ELIOT-019992DFC\Administrator <Administrator@eliot-019992dfc.(none)> | 2009-02-11 09:27:21 -0500 |
---|---|---|
committer | U-ELIOT-019992DFC\Administrator <Administrator@eliot-019992dfc.(none)> | 2009-02-11 09:27:21 -0500 |
commit | f694f826dd45bf1be2fe940ff311c4fbb61171c2 (patch) | |
tree | 591defe4aa251ecd8b38f5c5e9c31dbc3d1c2f4b | |
parent | 1515ab7f6bb227520e81f8eed88821af1fc9c2b4 (diff) | |
download | mongo-f694f826dd45bf1be2fe940ff311c4fbb61171c2.tar.gz |
windows fix for finding jars
-rw-r--r-- | db/javajs.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/db/javajs.cpp b/db/javajs.cpp index 7012c4ed3ed..5d2c7d5a3e3 100644 --- a/db/javajs.cpp +++ b/db/javajs.cpp @@ -565,16 +565,27 @@ namespace mongo { if ( ! possible.size() ) { possible.push_back( "./" ); possible.push_back( "../" ); - + log(2) << "dbExecCommand: " << dbExecCommand << endl; - if ( dbExecCommand.find( "/" ) != std::string::npos ){ - string dbDir = dbExecCommand.substr( 0 , dbExecCommand.find_last_of( "/" ) ); - log(2) << "dbDir [" << dbDir << "]" << endl; - possible.push_back( ( dbDir + "/../lib/mongo/" )); - possible.push_back( ( dbDir + "/../lib64/mongo/" )); - possible.push_back( ( dbDir + "/../lib32/mongo/" )); - } + string dbDir = dbExecCommand; +#ifdef WIN32 + if ( dbDir.find( "\\" ) != string::npos ){ + dbDir = dbDir.substr( 0 , dbDir.find_last_of( "\\" ) ); + } +#else + if ( dbDir.find( "/" ) != string::npos ){ + dbDir = dbDir.substr( 0 , dbDir.find_last_of( "/" ) ); + } +#endif + else { + dbDir = "."; + } + + log(2) << "dbDir [" << dbDir << "]" << endl; + possible.push_back( ( dbDir + "/../lib/mongo/" )); + possible.push_back( ( dbDir + "/../lib64/mongo/" )); + possible.push_back( ( dbDir + "/../lib32/mongo/" )); } for ( list<string>::iterator i = possible.begin() ; i != possible.end(); i++ ) { |