From 2df97b1fff7af6d0fc44def5dda39e3d54354116 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 26 Jul 2020 13:42:44 -0700 Subject: [PATCH] A couple small indexer tweaks and fixes. --- src/core/sdk/Filesystem.h | 1 + src/plugins/gmedecoder/GmeIndexerSource.cpp | 4 +++- src/plugins/libopenmptdecoder/OpenMptIndexerSource.cpp | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/sdk/Filesystem.h b/src/core/sdk/Filesystem.h index c264cb3e5..3b3dac61e 100644 --- a/src/core/sdk/Filesystem.h +++ b/src/core/sdk/Filesystem.h @@ -191,6 +191,7 @@ namespace musik { namespace core { namespace sdk { namespace fs { struct stat info = {0}; if (stat(fn.c_str(), &info) < 0) { + closedir(dir); return; } if (S_ISDIR(info.st_mode)) { diff --git a/src/plugins/gmedecoder/GmeIndexerSource.cpp b/src/plugins/gmedecoder/GmeIndexerSource.cpp index 03b26c906..f50f97d54 100644 --- a/src/plugins/gmedecoder/GmeIndexerSource.cpp +++ b/src/plugins/gmedecoder/GmeIndexerSource.cpp @@ -96,7 +96,9 @@ ScanResult GmeIndexerSource::Scan( }; for (auto& path : this->paths) { - fs::scanDirectory(std::string(path), checkFile, checkInterrupt); + if (!this->interrupt) { + fs::scanDirectory(std::string(path), checkFile, checkInterrupt); + } } indexer->CommitProgress(this, this->filesIndexed); diff --git a/src/plugins/libopenmptdecoder/OpenMptIndexerSource.cpp b/src/plugins/libopenmptdecoder/OpenMptIndexerSource.cpp index 17042042f..d3f20f89e 100644 --- a/src/plugins/libopenmptdecoder/OpenMptIndexerSource.cpp +++ b/src/plugins/libopenmptdecoder/OpenMptIndexerSource.cpp @@ -101,7 +101,9 @@ ScanResult OpenMptIndexerSource::Scan( }; for (auto& path : this->paths) { - fs::scanDirectory(std::string(path), checkFile, checkInterrupt); + if (!this->interrupt) { + fs::scanDirectory(std::string(path), checkFile, checkInterrupt); + } } indexer->CommitProgress(this, this->filesIndexed);