Implemented a better method to set the working directory for "tool" processes.
This commit is contained in:
parent
eb8da7b6f9
commit
f5985fb204
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -32,10 +32,10 @@
|
||||
|
||||
#define VER_LAMEXP_MAJOR 4
|
||||
#define VER_LAMEXP_MINOR_HI 1
|
||||
#define VER_LAMEXP_MINOR_LO 3
|
||||
#define VER_LAMEXP_TYPE Final
|
||||
#define VER_LAMEXP_MINOR_LO 4
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 1852
|
||||
#define VER_LAMEXP_BUILD 1854
|
||||
#define VER_LAMEXP_CONFG 1818
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -52,14 +52,12 @@ bool ADPCMDecoder::decode(const QString &sourceFile, const QString &outputFile,
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
args << "-V3" << "-S" << "--temp" << ".";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
args << "-e" << "signed-integer";
|
||||
args << QDir::toNativeSeparators(outputFile);
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -53,12 +53,10 @@ bool AvisynthDecoder::decode(const QString &sourceFile, const QString &outputFil
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).absolutePath());
|
||||
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
args << QDir::toNativeSeparators(outputFile);
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).absolutePath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -148,8 +148,6 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
|
||||
process.setProcessEnvironment(env);
|
||||
@ -193,7 +191,7 @@ bool FDKAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI
|
||||
args << "-o" << QDir::toNativeSeparators(outputFile);
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -156,8 +156,6 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
|
||||
process.setProcessEnvironment(env);
|
||||
@ -204,7 +202,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
|
||||
args << "-o" << QDir::toNativeSeparators(outputFile);
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
|
||||
if(!startProcess(process, qaac_bin, args))
|
||||
if(!startProcess(process, qaac_bin, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -64,8 +64,6 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile,
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
args << "-V3" << "-S";
|
||||
args << "--guard" << "--temp" << ".";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
@ -102,7 +100,7 @@ bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile,
|
||||
break;
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -62,8 +62,6 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
args << "-V3" << "-S";
|
||||
args << "--temp" << ".";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
@ -86,7 +84,7 @@ bool NormalizeFilter::apply(const QString &sourceFile, const QString &outputFile
|
||||
}
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -73,8 +73,6 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile,
|
||||
return true;
|
||||
}
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
args << "-V3" << "-S";
|
||||
args << "--guard" << "--temp" << ".";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
@ -99,7 +97,7 @@ bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile,
|
||||
args << "dither" << "-s"; //if you're mastering to 16-bit, you also need to add 'dither' (and in most cases noise-shaping) after the rate
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -56,8 +56,6 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil
|
||||
QProcess process;
|
||||
QStringList args;
|
||||
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
args << "-V3" << "-S";
|
||||
args << "--guard" << "--temp" << ".";
|
||||
args << QDir::toNativeSeparators(sourceFile);
|
||||
@ -72,7 +70,7 @@ bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFil
|
||||
args << "treble" << QString().sprintf("%s%.2f", ((m_treble < 0) ? "-" : "+"), static_cast<double>(abs(m_treble)) / 100.0);
|
||||
}
|
||||
|
||||
if(!startProcess(process, m_binary, args))
|
||||
if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -102,7 +102,7 @@ AbstractTool::~AbstractTool(void)
|
||||
/*
|
||||
* Initialize and launch process object
|
||||
*/
|
||||
bool AbstractTool::startProcess(QProcess &process, const QString &program, const QStringList &args)
|
||||
bool AbstractTool::startProcess(QProcess &process, const QString &program, const QStringList &args, const QString &workingDir)
|
||||
{
|
||||
QMutexLocker lock(&s_startProcessMutex);
|
||||
|
||||
@ -119,7 +119,7 @@ bool AbstractTool::startProcess(QProcess &process, const QString &program, const
|
||||
}
|
||||
|
||||
emit messageLogged(commandline2string(program, args) + "\n");
|
||||
MUtils::init_process(process, QFileInfo(program).absolutePath());
|
||||
MUtils::init_process(process, workingDir.isEmpty() ? QFileInfo(program).absolutePath() : workingDir);
|
||||
|
||||
process.start(program, args);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -41,7 +41,7 @@ public:
|
||||
AbstractTool(void);
|
||||
~AbstractTool(void);
|
||||
|
||||
bool startProcess(QProcess &process, const QString &program, const QStringList &args);
|
||||
bool startProcess(QProcess &process, const QString &program, const QStringList &args, const QString &workingDir = QString());
|
||||
static QString commandline2string(const QString &program, const QStringList &arguments);
|
||||
|
||||
signals:
|
||||
|
Loading…
Reference in New Issue
Block a user