mirror of https://gitee.com/bigwinds/arangodb
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:
parent
6bbcb1c934
commit
b8995c080f
|
@ -239,12 +239,8 @@ ManagedDirectory::ManagedDirectory(std::string const& path, bool requireEmpty, b
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> files(TRI_FullTreeDirectory(_path.c_str()));
|
std::vector<std::string> files(TRI_FilesDirectory(_path.c_str()));
|
||||||
bool isEmpty = (files.size() <= 1);
|
if (!files.empty()) {
|
||||||
// TODO: TRI_FullTreeDirectory always returns at least one element ("")
|
|
||||||
// even if directory is empty?
|
|
||||||
|
|
||||||
if (!isEmpty) {
|
|
||||||
// directory exists, has files, and we aren't allowed to overwrite
|
// directory exists, has files, and we aren't allowed to overwrite
|
||||||
if (requireEmpty) {
|
if (requireEmpty) {
|
||||||
_status.reset(TRI_ERROR_CANNOT_OVERWRITE_FILE,
|
_status.reset(TRI_ERROR_CANNOT_OVERWRITE_FILE,
|
||||||
|
|
Loading…
Reference in New Issue