mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +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 */
|
/* start recursive filesystem scan */
|
||||||
|
|
||||||
try { /* boost::filesystem may throw */
|
try {
|
||||||
|
|
||||||
/* for each file in the current path... */
|
/* for each file in the current path... */
|
||||||
|
|
||||||
boost::filesystem::path path(currentPath);
|
boost::filesystem::path path(currentPath);
|
||||||
boost::filesystem::directory_iterator end;
|
boost::filesystem::directory_iterator end;
|
||||||
boost::filesystem::directory_iterator file(path);
|
boost::filesystem::directory_iterator file(path);
|
||||||
@ -486,28 +484,33 @@ void Indexer::SyncDirectory(
|
|||||||
this->SyncDirectory(io, syncRoot, file->path().string(), pathId);
|
this->SyncDirectory(io, syncRoot, file->path().string(), pathId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::string extension = file->path().extension().string();
|
try {
|
||||||
for (auto it : this->tagReaders) {
|
std::string extension = file->path().extension().string();
|
||||||
if (it->CanRead(extension.c_str())) {
|
for (auto it : this->tagReaders) {
|
||||||
if (io) {
|
if (it->CanRead(extension.c_str())) {
|
||||||
io->post(boost::bind(
|
if (io) {
|
||||||
&Indexer::ReadMetadataFromFile,
|
io->post(boost::bind(
|
||||||
this,
|
&Indexer::ReadMetadataFromFile,
|
||||||
io,
|
this,
|
||||||
file->path(),
|
io,
|
||||||
pathIdStr));
|
file->path(),
|
||||||
|
pathIdStr));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->ReadMetadataFromFile(nullptr, file->path(), pathIdStr);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this->ReadMetadataFromFile(nullptr, file->path(), pathIdStr);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
/* boost::filesystem may throw trying to stat the file */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
|
/* boost::filesystem may throw trying to open the directory */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,15 +76,21 @@ static bool hasSubdirectories(
|
|||||||
directory_iterator file(p);
|
directory_iterator file(p);
|
||||||
|
|
||||||
while (file != end) {
|
while (file != end) {
|
||||||
if (is_directory(file->status())) {
|
try {
|
||||||
if (showDotfiles || file->path().leaf().string()[0] != '.') {
|
if (is_directory(file->status())) {
|
||||||
return true;
|
if (showDotfiles || file->path().leaf().string()[0] != '.') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
/* may throw trying to stat the file */
|
||||||
|
}
|
||||||
++file;
|
++file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
/* may throw trying to open the dir */
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -102,16 +108,22 @@ static void buildDirectoryList(
|
|||||||
directory_iterator file(p);
|
directory_iterator file(p);
|
||||||
|
|
||||||
while (file != end) {
|
while (file != end) {
|
||||||
if (is_directory(file->status())) {
|
try {
|
||||||
std::string leaf = file->path().leaf().string();
|
if (is_directory(file->status())) {
|
||||||
if (showDotfiles || leaf[0] != '.') {
|
std::string leaf = file->path().leaf().string();
|
||||||
target.push_back(leaf);
|
if (showDotfiles || leaf[0] != '.') {
|
||||||
|
target.push_back(leaf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (...) {
|
||||||
|
/* may throw trying to stat the file */
|
||||||
|
}
|
||||||
++file;
|
++file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
/* may throw trying to open the directory */
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user