Changeset 18656 for gsdl/trunk


Ignore:
Timestamp:
2009-03-11T11:06:35+13:00 (15 years ago)
Author:
kjdon
Message:

now look for .gdb files for collection databases, not ldb/bdb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/common-src/src/lib/gdbmclass.cpp

    r18051 r18656  
    7272  if (gdbm_mode == GDBM_READER)
    7373  {
    74     // If the specified GDBM file doesn't exist, try the other extension (we can now read both)
     74    // make sure we have the right file extension. Should be db (for systems dbs, and gdb for collection dbs. But need to handle old style ldb/bdb
     75
     76    // If the specified GDBM file doesn't exist, (should be gdb) try the other extensions (we can now read both)
    7577    if (!file_exists(gdbm_filename))
    7678    {
    77       if (ends_with(gdbm_filename, ".ldb"))
    78       {
    79     gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".ldb").size()) + ".bdb";
    80       }
    81       else if (ends_with(gdbm_filename, ".bdb"))
    82       {
    83     gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".bdb").size()) + ".ldb";
     79      if (ends_with(gdbm_filename, ".gdb")) {
     80    // only try ldb and bdb for collection dbs, not system dbs which are .db
     81    gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".gdb").size()) + ".ldb";
     82     
     83    if (!file_exists(gdbm_filename)) {
     84      // try bdb as well
     85      gdbm_filename = substr(gdbm_filename.begin(), gdbm_filename.end() - ((text_t) ".ldb").size()) + ".bdb";
     86    }
    8487      }
    8588    }
     
    146149text_t gdbmclass::getfileextension ()
    147150{
    148   if (littleEndian()) return ".ldb";
    149   return ".bdb";
     151  // now we always use gdb for gdbm files. later on, if we can't find it, we'll try ldb and bdb for backwards compatibility
     152  return ".gdb";
     153  //if (littleEndian()) return ".ldb";
     154  //return ".bdb";
    150155}
    151156
Note: See TracChangeset for help on using the changeset viewer.