You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2011/02/06 02:06:53 UTC
svn commit: r1067564 - /tuscany/sca-cpp/trunk/components/filedb/filedb.hpp
Author: jsdelfino
Date: Sun Feb 6 01:06:53 2011
New Revision: 1067564
URL: http://svn.apache.org/viewvc?rev=1067564&view=rev
Log:
Converts database key strings to symbols before computing database file names.
Modified:
tuscany/sca-cpp/trunk/components/filedb/filedb.hpp
Modified: tuscany/sca-cpp/trunk/components/filedb/filedb.hpp
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/components/filedb/filedb.hpp?rev=1067564&r1=1067563&r2=1067564&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/components/filedb/filedb.hpp (original)
+++ tuscany/sca-cpp/trunk/components/filedb/filedb.hpp Sun Feb 6 01:06:53 2011
@@ -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 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& k
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);