mirror of https://gitee.com/bigwinds/arangodb
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:
parent
a316a2f61f
commit
56fba25e91
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue