mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +00:00
Catch filesystem_error
This commit is contained in:
parent
0e3e567207
commit
43d1ec144c
@ -13,21 +13,25 @@ static void GetFilesInFolderHelper(
|
|||||||
std::queue<std::pair<fs::path, fs::path>> q;
|
std::queue<std::pair<fs::path, fs::path>> q;
|
||||||
q.emplace(fs::path(folder), fs::path(output_prefix));
|
q.emplace(fs::path(folder), fs::path(output_prefix));
|
||||||
while (!q.empty()) {
|
while (!q.empty()) {
|
||||||
for (auto it = fs::directory_iterator(q.front().first); it != fs::directory_iterator(); ++it) {
|
try {
|
||||||
auto path = it->path();
|
for (auto it = fs::directory_iterator(q.front().first);
|
||||||
std::string filename = path.filename();
|
it != fs::directory_iterator(); ++it) {
|
||||||
if (filename[0] != '.' || filename == ".ccls") {
|
auto path = it->path();
|
||||||
fs::file_status status = it->symlink_status();
|
std::string filename = path.filename();
|
||||||
if (fs::is_regular_file(status))
|
if (filename[0] != '.' || filename == ".ccls") {
|
||||||
handler(q.front().second / filename);
|
fs::file_status status = it->symlink_status();
|
||||||
else if (fs::is_directory(status) || fs::is_symlink(status)) {
|
if (fs::is_regular_file(status))
|
||||||
if (recursive) {
|
handler(q.front().second / filename);
|
||||||
std::string child_dir = q.front().second / filename;
|
else if (fs::is_directory(status) || fs::is_symlink(status)) {
|
||||||
if (fs::is_directory(status))
|
if (recursive) {
|
||||||
q.push(make_pair(path, child_dir));
|
std::string child_dir = q.front().second / filename;
|
||||||
|
if (fs::is_directory(status))
|
||||||
|
q.push(make_pair(path, child_dir));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (fs::filesystem_error&) {
|
||||||
}
|
}
|
||||||
q.pop();
|
q.pop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user