EXPORTED const char *mailbox_datapath(struct mailbox *mailbox, uint32_t uid)
{
    static char localbuf[MAX_MAILBOX_PATH];
    uint32_t legacy_dirs = (mailbox_mbtype(mailbox) & MBTYPE_LEGACY_DIRS);
    const char *src;

    src = mboxname_datapath(mailbox_partition(mailbox), mailbox_name(mailbox),
                            legacy_dirs ? NULL : mailbox_uniqueid(mailbox),
                            uid);
    if (!src) return NULL;

    xstrncpy(localbuf, src, MAX_MAILBOX_PATH);
    return localbuf;
}
EXPORTED const char *mailbox_datapath(struct mailbox *mailbox, uint32_t uid)
{
    static char localbuf[MAX_MAILBOX_PATH];
    uint32_t legacy_dirs = (mailbox_mbtype(mailbox) & MBTYPE_LEGACY_DIRS);
    const char *src;

    src = mboxname_datapath(mailbox_partition(mailbox), mailbox_name(mailbox),
                            legacy_dirs ? NULL : mailbox_uniqueid(mailbox),
                            uid);
    if (!src) return NULL;

    xstrncpy(localbuf, src, MAX_MAILBOX_PATH);
    return localbuf;
}