mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
aa5e6c7295
Summary: Update the copyright & license headers in C++ files to reflect the relicensing to GPLv2 Reviewed By: wez Differential Revision: D15487078 fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
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_++) {
|
|
DCHECK(!searchExpression_.empty());
|
|
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
|