1
0
Fork 0

Bug fix 3.5/dont scan recursive for whether dir empty (#10204)

* don't scan the specified directory recursively to find out whether its empty, only look at all files directly in it.

* Update arangosh/Utils/ManagedDirectory.cpp

Co-Authored-By: Jan <jsteemann@users.noreply.github.com>

* implement review
This commit is contained in:
Wilfried Goesgens 2019-10-09 17:27:17 +02:00 committed by KVS85
parent a316a2f61f
commit 56fba25e91
1 changed files with 2 additions and 6 deletions

View File

@ -243,12 +243,8 @@ ManagedDirectory::ManagedDirectory(std::string const& path, bool requireEmpty, b
return;
}
std::vector<std::string> files(TRI_FullTreeDirectory(_path.c_str()));
bool isEmpty = (files.size() <= 1);
// TODO: TRI_FullTreeDirectory always returns at least one element ("")
// even if directory is empty?
if (!isEmpty) {
std::vector<std::string> files(TRI_FilesDirectory(_path.c_str()));
if (!files.empty()) {
// directory exists, has files, and we aren't allowed to overwrite
if (requireEmpty) {
_status.reset(TRI_ERROR_CANNOT_OVERWRITE_FILE,