Commit 5d8fc1c1 authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Bug 709780 - Copying of files via \image tag can get confused by symlinks at the destination

parent 93d1c462
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -269,6 +269,14 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type)
	  break;
      }
      QCString outputFile = outputDir+"/"+result;
      QFileInfo outfi(outputFile);
      if (outfi.isSymLink())
      {
        QFile::remove(outputFile);
        warn_doc_error(g_fileName,doctokenizerYYlineno,
            "destination of image %s is a symlink, replacing with image",
            qPrint(outputFile));
      }
      if (outputFile!=inputFile) // prevent copying to ourself
      {
        QFile outImage(outputFile.data());
@@ -287,6 +295,10 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type)
              "could not write output image %s",qPrint(outputFile));
        }
      }
      else
      {
        printf("Source & Destination are the same!\n");
      }
    }
    else
    {