mu-scanner: ignore some more unusable files

This commit is contained in:
Dirk-Jan C. Binnema
2023-01-29 12:02:25 +02:00
parent 40c3d3568e
commit 6b4857b189

View File

@ -70,10 +70,18 @@ is_dotdir(const char *d_name)
}
static bool
is_ignoredir(const char *d_name)
do_ignore(const char *d_name)
{
/* gnus? */
if (d_name[0] == '.' && g_strcmp0(d_name + 1, "nnmaildir") == 0)
if (d_name[0] == '.') {
if (d_name[1] == '#') /* emacs? */
return true;
if (g_strcmp0(d_name + 1, "nnmaildir") == 0) /* gnus? */
return true;
if (g_strcmp0(d_name + 1, "notmuch") == 0) /* notmuch? */
return true;
}
if (g_strcmp0(d_name, "hcache.db") == 0) /* mutt cache? */
return true;
return false;
@ -87,8 +95,8 @@ Scanner::Private::process_dentry(const std::string& path, struct dirent *dentry,
if (is_dotdir(d_name) || std::strcmp(d_name, "tmp") == 0)
return true; // ignore.
if (is_ignoredir(d_name)) {
g_debug("skip %s/%s (ignore-dir)", path.c_str(), d_name);
if (do_ignore(d_name)) {
g_debug("skip %s/%s (ignore)", path.c_str(), d_name);
return true; // ignore
}