rem: QDir d;  if (!d.cd(path)) { cerr << "Can't go to directory \"" << maildirPath.ascii() << "\"" << endl; exit(1); }  QString maildirFullPath(path + "/cur/");  if (!d.cd(maildirFullPath)) { cerr << "Can't go to directory \"" << maildirFullPath.ascii() << "\"" << endl; exit(1); }
add: QString maildirFullPath(path + "/cur");
context: int main(int argc, char * argv[]){    if (argc != 3) {        cerr << "usage: mbox2maildir <mbox> <Maildir>" << endl;        exit(1);    }        QString mboxPath(argv[1]);    QString maildirPath(argv[2]);        struct utsname utsName;        if (uname(&utsName) != 0) {        cerr << "Can't get hostname" << endl;        exit(1);    }        struct timeval timeVal;    struct timezone timeZone;    gettimeofday(&timeVal, &timeZone);        hostName = utsName.nodename;    startSec = timeVal.tv_sec;    pid = (unsigned long)getpid();    seq = 0;    QFile mboxFile(mboxPath);        if (!mboxFile.open(IO_ReadOnly)) {        cerr << "Can't open mbox file \"" << mboxPath.ascii() << "\"" << endl;        exit(1);    }        path = QDir(maildirPath).absPath();        QDir d;        if (!d.cd(path)) {        cerr << "Can't go to directory \"" << maildirPath.ascii() <<            "\"" << endl;        exit(1);    }        QString maildirFullPath(path + "/cur/");        if (!d.cd(maildirFullPath)) {        cerr << "Can't go to directory \"" << maildirFullPath.ascii()            << "\"" << endl;        exit(1);    }        QTextStream str(&mboxFile);        QString buf;            int n = 0;    int failures = 0;        cerr << "Copying messages" << endl <<        "From: " << QFileInfo(mboxFile).absFilePath().ascii() << endl <<        "To:   " << path.ascii() << endl;            while (!str.eof()) {                    QString s = str.readLine();        if (s.find(QRegExp("^From[ \\t]"))) {                QString unique = generateUnique();                        QFile f(maildirFullPath + unique);                        if (0 != n++)                if (!writeMessage(buf))                    ++failures;                        buf.truncate(0);                        cerr << ".";        }                buf += s;    }    cerr << endl;        cerr << "Copied " << n << " messages OK" << endl;    if (failures != 0)        cerr << "Errors: " << failures << endl;}