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