1
0
Fork 0

Bug fix 3.4/dont scan recursive for whether dir empty (#10205)

* 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:25:48 +02:00 committed by KVS85
parent 6bbcb1c934
commit b8995c080f
1 changed files with 2 additions and 6 deletions

View File

@ -239,12 +239,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,