From 5d8fc1c198b8c5ccffa67eaddea7398fc2939449 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 12 Oct 2013 16:45:35 +0200 Subject: Bug 709780 - Copying of files via \image tag can get confused by symlinks at the destination --- src/docparser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/docparser.cpp b/src/docparser.cpp index 77b7bc0..9bb80ac 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -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 { -- cgit v0.12