mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
db849cfca1
Summary: Removing this DCHECK for the searchExpression because we can recieve requests for empty string and is a valid request. Reviewed By: chadaustin Differential Revision: D17985604 fbshipit-source-id: 40ffbe153a7ae44e85ed7d7ad7b2e79affb1d529
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "folly/portability/Windows.h"
|
|
|
|
#include <ProjectedFSLib.h>
|
|
#include "eden/fs/win/mount/Enumerator.h"
|
|
#include "eden/fs/win/store/WinStore.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
Enumerator::Enumerator(
|
|
const GUID& enumerationId,
|
|
const std::wstring& path,
|
|
std::vector<FileMetadata> entryList)
|
|
: path_(path), metadataList_(std::move(entryList)) {
|
|
std::sort(
|
|
metadataList_.begin(),
|
|
metadataList_.end(),
|
|
[](const FileMetadata& first, const FileMetadata& second) -> bool {
|
|
return (
|
|
PrjFileNameCompare(first.name.c_str(), second.name.c_str()) < 0);
|
|
});
|
|
}
|
|
|
|
const FileMetadata* Enumerator::current() {
|
|
for (; listIndex_ < metadataList_.size(); listIndex_++) {
|
|
if (PrjFileNameMatch(
|
|
metadataList_[listIndex_].name.c_str(),
|
|
searchExpression_.c_str())) {
|
|
//
|
|
// Don't increment the index here because we don't know if the caller
|
|
// would be able to use this. The caller should instead call advance() on
|
|
// success.
|
|
//
|
|
return &metadataList_[listIndex_];
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|