public
Fork of 10gen/mongo
Description: 10gen database
Homepage: http://www.10gen.com/wiki/db
Clone URL: git://github.com/tmm1/mongo.git
db.cpp : tweak correction of supplied data dir path to work on windows
also.  This needs a real fix - something a little more elegant
U-GEIR-5ACC88A714\Administrator (author)
Sat Aug 23 03:58:38 -0700 2008
commit  5599f9ec699d64f1dc4c5813ec25f77c1b31c1ce
tree    eec3dfa4839fb280ef89607dc60bd3b0741447b4
parent  b4d9b391a3c60915128ee544dba83d94925b5ad9
...
767
768
769
770
771
 
 
 
772
 
 
 
 
 
 
 
 
773
774
 
775
776
777
778
779
 
 
 
 
780
781
782
...
767
768
769
 
 
770
771
772
773
774
775
776
777
778
779
780
781
782
 
783
784
 
 
 
 
785
786
787
788
789
790
791
0
@@ -767,16 +767,25 @@ void initAndListen(int listenPort, const char *dbPath, const char *appserverLoc
0
 #endif
0
 
0
     /*
0
- * ensure that the dbpath ends w/ '/' as that's key in preventing things like
0
- * /data/dbadmin.ns
0
+ * ensure that the dbpath ends with a path delim if not supplied
0
+ * @TODO - the following is embarassing - not sure of there's a clean way to
0
+ * find the platform delim
0
      */
0
+
0
+ char endchar = '/';
0
+ char *endstr = "/";
0
+
0
+#if defined(_WIN32)
0
+ endchar = '\\';
0
+ endstr = "\\";
0
+#endif
0
     
0
- if (dbPath && dbPath[strlen(dbPath)-1] != '/') {
0
+ if (dbPath && dbPath[strlen(dbPath)-1] != endchar) {
0
       char *t = (char *) malloc(strlen(dbPath) + 2);
0
-
0
- strcpy(t, dbPath);
0
- strcat(t, "/");
0
- dbPath = t;
0
+
0
+ strcpy(t, dbPath);
0
+ strcat(t, endstr);
0
+ dbPath = t;
0
     }
0
 
0
     dbpath = dbPath;

Comments

    No one has commented yet.