summaryrefslogtreecommitdiff
path: root/db/javajs.cpp
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-09-15 15:31:30 -0400
committerDwight <dmerriman@gmail.com>2008-09-15 15:31:30 -0400
commit6f3628d022ec6406d1aa5cea3bba10ce118891ab (patch)
tree4784ed25da1442aabde8b2257d7ec4c462a30610 /db/javajs.cpp
parent379a7562629ff0803cfb30e0abfcddcbee046a19 (diff)
parentdb91183962d36d596157837a928217c411b84a7e (diff)
downloadmongo-6f3628d022ec6406d1aa5cea3bba10ce118891ab.tar.gz
Merge branch 'master' of ssh://git.10gen.com/data/gitroot/pr0.1.3_rc1
Diffstat (limited to 'db/javajs.cpp')
-rw-r--r--db/javajs.cpp50
1 files changed, 28 insertions, 22 deletions
diff --git a/db/javajs.cpp b/db/javajs.cpp
index 9d4d558731b..dc9b6b38ab2 100644
--- a/db/javajs.cpp
+++ b/db/javajs.cpp
@@ -79,6 +79,26 @@ JavaJSImpl::JavaJSImpl() {
JavaJSImpl(null);
}
+#if defined(_WIN32)
+const char SYSTEM_COLON = ';';
+#else
+const char SYSTEM_COLON = ':';
+#endif
+
+
+void _addClassPath( const char * ed , stringstream & ss , const char * subdir ){
+ path includeDir(ed);
+ includeDir /= subdir;
+ directory_iterator end;
+ directory_iterator i(includeDir);
+ while( i != end ) {
+ path p = *i;
+ ss << SYSTEM_COLON << p.string();
+ i++;
+ }
+}
+
+
JavaJSImpl::JavaJSImpl(const char *appserverPath){
_jvm = 0;
_mainEnv = 0;
@@ -87,35 +107,21 @@ JavaJSImpl::JavaJSImpl(const char *appserverPath){
const char * ed = findEd(appserverPath);
stringstream ss;
-#if defined(_WIN32)
- char colon = ';';
-#else
- char colon = ':';
-#endif
-
ss << "-Djava.class.path=.";
- ss << colon << ed << "/build/";
-
- {
- path includeDir(ed);
- includeDir /= "include";
- directory_iterator end;
- directory_iterator i(includeDir);
- while( i != end ) {
- path p = *i;
- ss << colon << p.string();
- i++;
- }
- }
+ ss << SYSTEM_COLON << ed << "/build/";
+
+ _addClassPath( ed , ss , "include" );
+ _addClassPath( ed , ss , "include/jython/" );
+ _addClassPath( ed , ss , "include/jython/javalib" );
#if defined(_WIN32)
- ss << colon << "C:\\Program Files\\Java\\jdk\\lib\\tools.jar";
+ ss << SYSTEM_COLON << "C:\\Program Files\\Java\\jdk\\lib\\tools.jar";
#else
- ss << colon << "/opt/java/lib/tools.jar";
+ ss << SYSTEM_COLON << "/opt/java/lib/tools.jar";
#endif
if( getenv( "CLASSPATH" ) )
- ss << colon << getenv( "CLASSPATH" );
+ ss << SYSTEM_COLON << getenv( "CLASSPATH" );
string s = ss.str();
char * p = (char *)malloc( s.size() * 4 );