diff options
author | Dwight <dmerriman@gmail.com> | 2009-02-11 09:34:09 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-02-11 09:34:09 -0500 |
commit | 6a7ce4dd637686f3ce446c0f4051795bba91313e (patch) | |
tree | e877474a71ef5103c418f36a5f8a9be6c7ae96a2 | |
parent | 8154c0af5e2d528e25ea5b30ee3639362ff491a7 (diff) | |
parent | f694f826dd45bf1be2fe940ff311c4fbb61171c2 (diff) | |
download | mongo-6a7ce4dd637686f3ce446c0f4051795bba91313e.tar.gz |
Merge branch 'master' of git.10gen.com:/data/gitroot/p
-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++ ) { |