60 struct dirent *de = NULL;
71 snprintf(realpath,
sizeof(realpath),
"%s/%s",
buf_string(path),
72 (iter == 0) ?
"cur" :
"new");
76 while ((de = readdir(dir)))
78 if (*de->d_name !=
'.')
86 }
while (rc && iter < 2);
96 if (!st || !S_ISDIR(st->st_mode))
100 struct stat stsub = { 0 };
101 char *subs[] = {
"cur",
"new" };
104 snprintf(sub,
sizeof(sub),
"%s/%s", path, subs[i]);
105 if ((stat(sub, &stsub) == 0) && S_ISDIR(stsub.st_mode))
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
char * HomeDir
User's home directory.
MailboxType
Supported mailbox formats.
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
@ MUTT_MAILDIR
'Maildir' Mailbox type
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
@ MUTT_OPENDIR_CREATE
Create the directory if it doesn't exist.
int maildir_path_canon(struct Buffer *path)
Canonicalise a Mailbox path - Implements MxOps::path_canon() -.
enum MailboxType maildir_path_probe(const char *path, const struct stat *st)
Is this a Maildir Mailbox? - Implements MxOps::path_probe() -.
int maildir_path_is_empty(struct Buffer *path)
Is the mailbox empty.
#define mutt_array_size(x)
Convenience wrapper for the library headers.
bool mutt_path_canon(struct Buffer *path, const char *homedir, bool is_dir)
Create the canonical version of a path.
Path manipulation functions.
String manipulation buffer.