* mu-maildir: start maildirs (for the maildir: search param) with a slash

(well, G_DIR_SEPARATOR); thus, we can find mails in the 'root' maildir as
  well. When indexing under (say) ~/Maildir, a mail in cur will have maildir
  '/', and in foo/cur will have '/foo'
This commit is contained in:
Dirk-Jan C. Binnema 2010-02-15 20:24:00 +02:00
parent 01d6fbb257
commit 451be4394d
1 changed files with 10 additions and 8 deletions

View File

@ -384,11 +384,11 @@ static gchar*
get_mdir_for_path (const gchar *old_mdir, const gchar *dir)
{
if (dir[0] != 'n' && dir[0] != 'c' &&
strcmp(dir, "cur") != 0 && strcmp(dir, "new") != 0)
return g_strconcat (old_mdir, strlen(old_mdir)?G_DIR_SEPARATOR_S:"",
dir, NULL);
strcmp(dir, "cur") != 0 && strcmp(dir, "new") != 0)
return g_strconcat (old_mdir ? old_mdir : "",
G_DIR_SEPARATOR_S, dir, NULL);
else
return strdup (old_mdir);
return strdup (old_mdir ? old_mdir : G_DIR_SEPARATOR_S);
}
@ -553,11 +553,12 @@ mu_maildir_walk (const char *path, MuMaildirWalkMsgCallback cb_msg,
/* skip the final slash from dirnames */
mypath = g_strdup (path);
/* strip the final / or \ */
/* strip the final / or \ */
if (mypath[strlen(mypath)-1] == G_DIR_SEPARATOR)
mypath[strlen(mypath)-1] = '\0';
rv = process_dir (mypath, "", cb_msg, cb_dir, data);
rv = process_dir (mypath, NULL, cb_msg,
cb_dir, data);
g_free (mypath);
return rv;
@ -584,8 +585,9 @@ clear_links (const gchar* dirname, DIR *dir)
if (entry->d_type != DT_LNK && entry->d_type != DT_DIR)
continue;
/* we have to copy the buffer from fullpath_s, because it
* returns a static buffer and we are recursive*/
/* we have to copy the buffer from fullpath_s, because
* it returns a static buffer and we are
* recursive*/
fp = fullpath_s (dirname, entry->d_name);
fullpath = g_newa (char, strlen(fp) + 1);
strcpy (fullpath, fp);