From e5da9c88039c360065f20cfd513f2fe68430f04a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 7 May 2007 16:59:19 +0000 Subject: [PATCH] * Create the database directory if it doesn't exist. --- src/libstore/db.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libstore/db.cc b/src/libstore/db.cc index c3cdd3232..657f6b7b4 100644 --- a/src/libstore/db.cc +++ b/src/libstore/db.cc @@ -142,6 +142,15 @@ Database::~Database() 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 { env->open(path.c_str(), DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |