Ticket #1747: main.cpp.2.diff

File main.cpp.2.diff, 1.3 KB (added by smalenfant@…, 18 years ago)
  • main.cpp

     
    615615
    616616        if (!gContext->GetNumSetting("SaveTranscoding", 0))
    617617        {
    618             if (unlink(oldfile) == -1)
    619                 perror(QString("mythtranscode: Error Deleting '%1'")
    620                        .arg(oldfile).ascii());
     618            int err;
     619            bool followLinks = gContext->GetNumSetting("DeletesFollowLinks", 0);
     620
     621            VERBOSE(VB_FILE, QString("mythtranscode: About to unlink/delete file: %1").arg(oldfile));
     622            if (followLinks)
     623            {
     624                QFileInfo finfo(oldfile);
     625                if (finfo.isSymLink() && (err = unlink(finfo.readLink().local8Bit())))
     626                {
     627                     VERBOSE(VB_IMPORTANT, QString("Error deleting '%1' @ '%2', %3")
     628                             .arg(oldfile).arg(finfo.readLink().local8Bit())
     629                             .arg(strerror(errno)));
     630                }
     631            }
     632 
     633            if ((err = unlink(oldfile.local8Bit())))
     634            VERBOSE(VB_IMPORTANT, QString("mythtranscode: Error deleting '%1', %2")
     635                    .arg(oldfile).arg(strerror(errno)));
    621636        }
    622637
    623638        oldfile = filename + ".png";