Fix detection of Nero AAA encoder + use canonicalPath() where suitable

This commit is contained in:
LoRd_MuldeR 2010-11-15 22:07:46 +01:00
parent e76fcafb8d
commit b1137e4cb1
5 changed files with 16 additions and 15 deletions

View File

@ -348,7 +348,7 @@ void MainWindow::dropEvent(QDropEvent *event)
QList<QFileInfo> list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files); QList<QFileInfo> list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files);
for(int j = 0; j < list.count(); j++) for(int j = 0; j < list.count(); j++)
{ {
droppedFiles << list.at(j).absoluteFilePath(); droppedFiles << list.at(j).canonicalFilePath();
} }
} }
} }
@ -390,7 +390,7 @@ void MainWindow::windowShown(void)
} }
//Check for AAC support //Check for AAC support
if(radioButtonEncoderAAC->isEnabled()) if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
{ {
if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac()) if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
{ {
@ -404,6 +404,7 @@ void MainWindow::windowShown(void)
} }
else else
{ {
radioButtonEncoderAAC->setEnabled(false);
QString messageText; QString messageText;
messageText += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>"; messageText += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>";
messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>"; messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>";
@ -808,7 +809,7 @@ void MainWindow::makeFolderButtonClicked(void)
QDir createdDir = basePath; QDir createdDir = basePath;
if(createdDir.cd(newFolder)) if(createdDir.cd(newFolder))
{ {
outputFolderView->setCurrentIndex(m_fileSystemModel->index(createdDir.absolutePath())); outputFolderView->setCurrentIndex(m_fileSystemModel->index(createdDir.canonicalPath()));
outputFolderViewClicked(outputFolderView->currentIndex()); outputFolderViewClicked(outputFolderView->currentIndex());
outputFolderView->setFocus(); outputFolderView->setFocus();
} }
@ -925,7 +926,7 @@ void MainWindow::handleDelayedFiles(void)
QList<QFileInfo> list = QDir(currentFile.canonicalFilePath()).entryInfoList(QDir::Files); QList<QFileInfo> list = QDir(currentFile.canonicalFilePath()).entryInfoList(QDir::Files);
for(int j = 0; j < list.count(); j++) for(int j = 0; j < list.count(); j++)
{ {
selectedFiles << list.at(j).absoluteFilePath(); selectedFiles << list.at(j).canonicalFilePath();
} }
} }
} }

View File

@ -492,7 +492,7 @@ const QString &lamexp_temp_folder(void)
if(tempFolder.cd(uuid)) if(tempFolder.cd(uuid))
{ {
g_lamexp_temp_folder = tempFolder.absolutePath(); g_lamexp_temp_folder = tempFolder.canonicalPath();
} }
else else
{ {
@ -520,11 +520,11 @@ bool lamexp_clean_folder(const QString folderPath)
if(entryList.at(i).isDir()) if(entryList.at(i).isDir())
{ {
lamexp_clean_folder(entryList.at(i).absoluteFilePath()); lamexp_clean_folder(entryList.at(i).canonicalFilePath());
} }
else else
{ {
QFile::remove(entryList.at(i).absoluteFilePath()); QFile::remove(entryList.at(i).canonicalFilePath());
} }
} }

View File

@ -43,7 +43,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
{ {
if(outFile.write(reinterpret_cast<const char*>(resource.data()), resource.size()) != resource.size()) if(outFile.write(reinterpret_cast<const char*>(resource.data()), resource.size()) != resource.size())
{ {
QFile::remove(QFileInfo(outFile).absoluteFilePath()); QFile::remove(QFileInfo(outFile).canonicalFilePath());
char error_msg[512]; char error_msg[512];
strcpy_s(error_msg, 512, QString("File '%1' could not be written!").arg(QFileInfo(outFile).fileName()).toUtf8().constData()); strcpy_s(error_msg, 512, QString("File '%1' could not be written!").arg(QFileInfo(outFile).fileName()).toUtf8().constData());
throw error_msg; throw error_msg;
@ -62,7 +62,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
if(m_fileHandle == INVALID_HANDLE_VALUE) if(m_fileHandle == INVALID_HANDLE_VALUE)
{ {
QFile::remove(QFileInfo(outFile).absoluteFilePath()); QFile::remove(QFileInfo(outFile).canonicalFilePath());
char error_msg[512]; char error_msg[512];
strcpy_s(error_msg, 512, QString("File '%1' could not be locked!").arg(QFileInfo(outFile).fileName()).toLatin1().constData()); strcpy_s(error_msg, 512, QString("File '%1' could not be locked!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
throw error_msg; throw error_msg;
@ -81,7 +81,7 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
{ {
qWarning("\nFile checksum error:\n Expected = %040s\n Detected = %040s\n", expectedHash.constData(), fileHash.result().toHex().constData()); qWarning("\nFile checksum error:\n Expected = %040s\n Detected = %040s\n", expectedHash.constData(), fileHash.result().toHex().constData());
LAMEXP_CLOSE(m_fileHandle); LAMEXP_CLOSE(m_fileHandle);
QFile::remove(QFileInfo(outFile).absoluteFilePath()); QFile::remove(QFileInfo(outFile).canonicalFilePath());
char error_msg[512]; char error_msg[512];
strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData()); strcpy_s(error_msg, 512, QString("File '%1' is corruputed, take care!").arg(QFileInfo(outFile).fileName()).toLatin1().constData());
throw error_msg; throw error_msg;

View File

@ -129,14 +129,14 @@ void FileListModel::addFile(const QString &filePath)
for(int i = 0; i < m_fileList.count(); i++) for(int i = 0; i < m_fileList.count(); i++)
{ {
if(m_fileList.at(i).filePath().compare(fileInfo.absoluteFilePath(), Qt::CaseInsensitive) == 0) if(m_fileList.at(i).filePath().compare(fileInfo.canonicalFilePath(), Qt::CaseInsensitive) == 0)
{ {
return; return;
} }
} }
beginResetModel(); beginResetModel();
m_fileList.append(AudioFileModel(fileInfo.absoluteFilePath(), fileInfo.baseName())); m_fileList.append(AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName()));
endResetModel(); endResetModel();
} }

View File

@ -150,7 +150,7 @@ void InitializationThread::initNeroAac(void)
return; return;
} }
qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].absoluteFilePath().toUtf8().constData()); qDebug("Found Nero AAC encoder binary:\n%s\n", neroFileInfo[0].canonicalFilePath().toUtf8().constData());
LockedFile *neroBin[3]; LockedFile *neroBin[3];
for(int i = 0; i < 3; i++) neroBin[i] = NULL; for(int i = 0; i < 3; i++) neroBin[i] = NULL;
@ -159,7 +159,7 @@ void InitializationThread::initNeroAac(void)
{ {
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
neroBin[i] = new LockedFile(neroFileInfo[i].absoluteFilePath()); neroBin[i] = new LockedFile(neroFileInfo[i].canonicalFilePath());
} }
} }
catch(...) catch(...)
@ -172,7 +172,7 @@ void InitializationThread::initNeroAac(void)
QProcess process; QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels); process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput); process.setReadChannel(QProcess::StandardOutput);
process.start(neroFileInfo[0].absoluteFilePath()); process.start(neroFileInfo[0].canonicalFilePath());
if(!process.waitForStarted()) if(!process.waitForStarted())
{ {