From 67a060a8cf7b2789960f7bf3f63c70559c916292 Mon Sep 17 00:00:00 2001 From: Simon Inns Date: Wed, 2 Dec 2020 20:06:04 +0100 Subject: [PATCH] Fix for issue #557 --- tools/ld-discmap/discmapper.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/ld-discmap/discmapper.cpp b/tools/ld-discmap/discmapper.cpp index 1864ab343..0fd538be7 100644 --- a/tools/ld-discmap/discmapper.cpp +++ b/tools/ld-discmap/discmapper.cpp @@ -620,17 +620,23 @@ bool DiscMapper::saveDiscMap(DiscMap &discMap) // Open the input audio file if (!sourceAudio.open(inputFileInfo)) { // Could not open input audio file - qInfo() << "Cannot open source audio file:" << inputFileInfo.absolutePath() + "/" + inputFileInfo.baseName() + ".pcm"; + qInfo() << "Cannot open source audio file:" << inputFileInfo.absolutePath() + "/" + inputFileInfo.completeBaseName() + ".pcm"; sourceVideo.close(); sourceAudio.close(); return false; } // Open the output audio file - targetAudio.setFileName(outputFileInfo.absolutePath() + "/" + outputFileInfo.baseName() + ".pcm"); + targetAudio.setFileName(outputFileInfo.absolutePath() + "/" + outputFileInfo.completeBaseName() + ".pcm"); + if (targetAudio.exists()) { + qInfo() << "Target audio file already exists:" << targetAudio.fileName() << "- Cannot proceed!"; + sourceVideo.close(); + sourceAudio.close(); + return false; + } if (!targetAudio.open(QIODevice::WriteOnly)) { // Could not open target audio file - qInfo() << "Cannot open target audio file:" << outputFileInfo.absolutePath() + "/" + outputFileInfo.baseName() + ".pcm"; + qInfo() << "Cannot open target audio file:" << targetAudio.fileName(); sourceVideo.close(); sourceAudio.close(); return false;