* Create the database directory if it doesn't exist.
This commit is contained in:
parent
30beeb27a9
commit
e5da9c8803
1 changed files with 9 additions and 0 deletions
|
@ -142,6 +142,15 @@ Database::~Database()
|
||||||
|
|
||||||
void openEnv(DbEnv * & env, const string & path, u_int32_t flags)
|
void openEnv(DbEnv * & env, const string & path, u_int32_t flags)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
createDirs(path);
|
||||||
|
} catch (SysError & e) {
|
||||||
|
if (e.errNo == EPERM || e.errNo == EACCES)
|
||||||
|
throw DbNoPermission(format("cannot create the Nix database in `%1%'") % path);
|
||||||
|
else
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
env->open(path.c_str(),
|
env->open(path.c_str(),
|
||||||
DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |
|
DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |
|
||||||
|
|
Loading…
Reference in a new issue