diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index a4215e69..47397372 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2945,47 +2945,47 @@ - + Unknown File Name - + Unknown Title - + Unknown Artist - + Unknown Album - + Unknown Comment - + Target output file already exists, going to skip this file: - + If you don't want existing files to be skipped, please change the overwrite mode! - + Target output file already exists, going to delete existing file: - + Failed to delete existing target file, will save to another file name! diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 04853e6b..eb80a9d6 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -2962,47 +2962,47 @@ Nie można zapisać do lokalizacji docelowej: - + Unknown File Name Nieznana nazwa pliku - + Unknown Title Nieznany Tytuł - + Unknown Artist Nieznany Artysta - + Unknown Album Nieznany Album - + Unknown Comment Nieznany Komentarz - + Target output file already exists, going to skip this file: Plik wynikowy już istnieje, zostanie pominięty plik: - + If you don't want existing files to be skipped, please change the overwrite mode! Jeśli nie chcesz aby istniejące pliki były pomijane, zmień tryb nadpisywania! - + Target output file already exists, going to delete existing file: Plik wynikowy już istnieje, zostanie usunięty plik: - + Failed to delete existing target file, will save to another file name! Usuwanie istniejącego pliku zakończone niepowodzeniem, nowy plik zostanie zapisany pod inną nazwą! diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index 0b46465b..9dfb26b6 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -2955,47 +2955,47 @@ Målmappen är INTE skrivbar: - + Unknown File Name Okänt filnamn - + Unknown Title Okänd titel - + Unknown Artist Okänd artist - + Unknown Album Okänt album - + Unknown Comment Okänd kommentar - + Target output file already exists, going to skip this file: Målfilen finns redan! Den här filen hoppas över: - + If you don't want existing files to be skipped, please change the overwrite mode! Om du inte vill att befintliga filer hoppas över, måste du ändra överskrivningsläge! - + Target output file already exists, going to delete existing file: Målfilen finns redan! Befintlig fil kommer att tas bort: - + Failed to delete existing target file, will save to another file name! Kunde inte ta bort befintlig målfil. Sparar med annat filnamn! diff --git a/src/Config.h b/src/Config.h index 40604ad4..5c1adf12 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 0 #define VER_LAMEXP_TYPE RC #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 1550 +#define VER_LAMEXP_BUILD 1551 #define VER_LAMEXP_CONFG 1528 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 614d296f..bc052439 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -376,7 +376,7 @@ int ProcessThread::generateOutFileName(QString &outFileName) //Make sure the source file exists QFileInfo sourceFile(m_audioFile.filePath()); - if(!sourceFile.exists() || !sourceFile.isFile()) + if(!(sourceFile.exists() && sourceFile.isFile())) { handleMessage(QString("%1\n%2").arg(tr("The source audio file could not be found:"), sourceFile.absoluteFilePath())); return 0; @@ -428,7 +428,6 @@ int ProcessThread::generateOutFileName(QString &outFileName) } else { - writeTest.close(); writeTest.remove(); } @@ -447,26 +446,30 @@ int ProcessThread::generateOutFileName(QString &outFileName) } //Delete file, if target file exists (optional!) - if(m_overwriteReplacesExisting && QFileInfo(outFileName).exists()) + if(m_overwriteReplacesExisting && QFileInfo(outFileName).exists() && QFileInfo(outFileName).isFile()) { - handleMessage(QString("%1\n%2\n").arg(tr("Target output file already exists, going to delete existing file:"), QDir::toNativeSeparators(outFileName))); - bool bOkay = false; - for(int i = 0; i < 16; i++) + if(sourceFile.canonicalFilePath().compare(QFileInfo(outFileName).absoluteFilePath(), Qt::CaseInsensitive) != 0) { - bOkay = QFile::remove(outFileName); - if(bOkay) break; - lamexp_sleep(125); - } - if(QFileInfo(outFileName).exists() || (!bOkay)) - { - handleMessage(QString("%1\n").arg(tr("Failed to delete existing target file, will save to another file name!"))); + handleMessage(QString("%1\n%2\n").arg(tr("Target output file already exists, going to delete existing file:"), QDir::toNativeSeparators(outFileName))); + for(int i = 0; i < 16; i++) + { + if(QFile::remove(outFileName)) + { + break; + } + lamexp_sleep(125); + } + if(QFileInfo(outFileName).exists()) + { + handleMessage(QString("%1\n").arg(tr("Failed to delete existing target file, will save to another file name!"))); + } } } int n = 1; //Generate final name - while(QFileInfo(outFileName).exists()) + while(QFileInfo(outFileName).exists() && (n < (INT_MAX/2))) { outFileName = QString("%1/%2 (%3).%4").arg(targetDir.canonicalPath(), fileName, QString::number(++n), m_encoder->extension()); }