mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Fix issues that may incorrectly interupt directory traversal.
This commit is contained in:
parent
921af81536
commit
c6ecea564c
@ -465,10 +465,8 @@ void Indexer::SyncDirectory(
|
||||
|
||||
/* start recursive filesystem scan */
|
||||
|
||||
try { /* boost::filesystem may throw */
|
||||
|
||||
try {
|
||||
/* for each file in the current path... */
|
||||
|
||||
boost::filesystem::path path(currentPath);
|
||||
boost::filesystem::directory_iterator end;
|
||||
boost::filesystem::directory_iterator file(path);
|
||||
@ -486,6 +484,7 @@ void Indexer::SyncDirectory(
|
||||
this->SyncDirectory(io, syncRoot, file->path().string(), pathId);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
std::string extension = file->path().extension().string();
|
||||
for (auto it : this->tagReaders) {
|
||||
if (it->CanRead(extension.c_str())) {
|
||||
@ -503,11 +502,15 @@ void Indexer::SyncDirectory(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (...) {
|
||||
/* boost::filesystem may throw trying to stat the file */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
/* boost::filesystem may throw trying to open the directory */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,15 +76,21 @@ static bool hasSubdirectories(
|
||||
directory_iterator file(p);
|
||||
|
||||
while (file != end) {
|
||||
try {
|
||||
if (is_directory(file->status())) {
|
||||
if (showDotfiles || file->path().leaf().string()[0] != '.') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
/* may throw trying to stat the file */
|
||||
}
|
||||
++file;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
/* may throw trying to open the dir */
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -102,16 +108,22 @@ static void buildDirectoryList(
|
||||
directory_iterator file(p);
|
||||
|
||||
while (file != end) {
|
||||
try {
|
||||
if (is_directory(file->status())) {
|
||||
std::string leaf = file->path().leaf().string();
|
||||
if (showDotfiles || leaf[0] != '.') {
|
||||
target.push_back(leaf);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
/* may throw trying to stat the file */
|
||||
}
|
||||
++file;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
/* may throw trying to open the directory */
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user