diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-06 01:06:53 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-06 01:06:53 +0000 |
commit | 16e2eaecd50b40da545a5b04e2ba2a2fbe4a1b60 (patch) | |
tree | 300a931f97acb44996cb86368ca3cfc2ea1e1d83 /sca-cpp/trunk | |
parent | 3e1309dbb69d64d91c328763c7a2dd4a6bcf9427 (diff) |
Converts database key strings to symbols before computing database file names.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1067564 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk')
-rw-r--r-- | sca-cpp/trunk/components/filedb/filedb.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sca-cpp/trunk/components/filedb/filedb.hpp b/sca-cpp/trunk/components/filedb/filedb.hpp index 39c8aff868..b5690d0f1b 100644 --- a/sca-cpp/trunk/components/filedb/filedb.hpp +++ b/sca-cpp/trunk/components/filedb/filedb.hpp @@ -87,7 +87,7 @@ private: const string filename(const list<value>& path, const string& root) { if (isNil(path)) return root; - string name = root + "/" + scheme::writeValue(car(path)); + const string name = root + "/" + (isString(car(path))? (string)car(path) : scheme::writeValue(car(path))); return filename(cdr(path), name); } @@ -103,7 +103,7 @@ const string filename(const value& key, const string& root) { const failable<bool> mkdirs(const list<value>& path, const string& root) { if (isNil(cdr(path))) return true; - string dir = root + "/" + scheme::writeValue(car(path)); + const string dir = root + "/" + (isString(car(path))? (string)car(path) : scheme::writeValue(car(path))); mkdir(c_str(dir), S_IRWXU); return mkdirs(cdr(path), dir); } @@ -200,7 +200,9 @@ const failable<value> get(const value& key, FileDB& db) { debug(key, "filedb::get::key"); debug(db.name, "filedb::get::dbname"); - ifstream is(filename(key, db.name)); + const string fn = filename(key, db.name); + debug(fn, "filedb::get::filename"); + ifstream is(fn); if (is.fail()) return mkfailure<value>("Couldn't get file database entry."); const failable<value> val = read(is, db.format, db); |