mirror of https://github.com/djcb/mu.git
mu-store: create mu cache path if needed
This commit is contained in:
parent
41c7c6b0d5
commit
38c18f11f2
|
@ -116,6 +116,11 @@ struct Store::Private {
|
|||
* backstop*/
|
||||
g_setenv("XAPIAN_FLUSH_THRESHOLD", "500000", 1);
|
||||
|
||||
if (g_mkdir_with_parents(db_path.c_str(), 0700) != 0)
|
||||
throw Mu::Error(Error::Code::Internal,
|
||||
"failed to create database dir %s: %s",
|
||||
db_path.c_str(), ::strerror(errno));
|
||||
|
||||
switch (opts) {
|
||||
case XapianOpts::ReadOnly:
|
||||
return std::make_unique<Xapian::Database>(db_path);
|
||||
|
@ -135,6 +140,8 @@ struct Store::Private {
|
|||
} catch (const Xapian::DatabaseError& xde) {
|
||||
throw Mu::Error(Error::Code::Store,
|
||||
"%s", xde.get_msg().c_str());
|
||||
} catch (const Mu::Error& me) {
|
||||
throw;
|
||||
} catch (...) {
|
||||
throw Mu::Error(Error::Code::Internal,
|
||||
"something went wrong when opening store @ %s",
|
||||
|
|
Loading…
Reference in New Issue