Navigation Menu

Skip to content

Commit

Permalink
[setup] allow to setup also if target dir is empty
Browse files Browse the repository at this point in the history
Vault did not allowed to setup storage if target directory had been existed
before. Allow to do it if directory is empty, so directory can be created
separately (e.g. with special permissions, bind mount, symlink etc.)

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>
  • Loading branch information
Denis Zalevskiy committed Mar 4, 2015
1 parent 42948f9 commit a5d096c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/vault.cpp
Expand Up @@ -337,8 +337,13 @@ void Vault::setup(const QVariantMap *config)
} else if (config) {
debug::info("Repository initialization is requested");

if (os::path::exists(m_path))
error::raise({{"msg", "Vault dir already exists, can't create"}, {"path", m_path}});
if (os::path::exists(m_path)) {
QDir d(m_path);
if (!d.entryList(QDir::NoDotAndDotDot).isEmpty())
error::raise({
{"msg", "Vault dir already exists and not empty"}
, {"path", m_path}});
}

try {
createRepo();
Expand Down

0 comments on commit a5d096c

Please sign in to comment.