Now using our own command-line parser, based on GetCommandLineW() + CommandLineToArgvW , instead of using QApplication::arguments(). This is less portable, but Qt's internal command-line parser has some rather strange behavior with processing certain characters. As a result, with Qt's command-line parser, some path names passed to LameXP got screwed up! Specifically "C:\Some Path\''Foo''.mp3" got mangled to "C:\Some Path''Foo''.mp3", i.e. the Backslash disappeared! Should be fixed now.
This commit is contained in:
parent
accee3da7a
commit
30bc239cd8
@ -24,6 +24,7 @@ a:visited { color: #0000EE; }
|
|||||||
<li>Implemented multi-threading in initialization code for faster application startup
|
<li>Implemented multi-threading in initialization code for faster application startup
|
||||||
<li>Fixed a potential crash (stack overflow) when adding a huge number of files
|
<li>Fixed a potential crash (stack overflow) when adding a huge number of files
|
||||||
<li>Fixed a problem with Cue Sheet import and files that contain trailing dots in their name
|
<li>Fixed a problem with Cue Sheet import and files that contain trailing dots in their name
|
||||||
|
<li>Workaround for a bug (feature?) of Qt's command-line parser that screwed up some arguments
|
||||||
</ul><br>
|
</ul><br>
|
||||||
|
|
||||||
<a name="4.04"></a>Changes between v4.03 and v4.04 [2012-04-26]:<br><ul>
|
<a name="4.04"></a>Changes between v4.03 and v4.04 [2012-04-26]:<br><ul>
|
||||||
|
@ -27,7 +27,8 @@ if "%VER_LAMEXP_TYPE%"=="" GOTO:EOF
|
|||||||
if "%VER_LAMEXP_PATCH%"=="" GOTO:EOF
|
if "%VER_LAMEXP_PATCH%"=="" GOTO:EOF
|
||||||
REM ------------------------------------------
|
REM ------------------------------------------
|
||||||
set "VER_LAMEXP_BASENAME=LameXP"
|
set "VER_LAMEXP_BASENAME=LameXP"
|
||||||
if not "%VER_LAMEXP_TYPE%" == "Final" set "VER_LAMEXP_BASENAME=LameXP-PRERELEASE"
|
if "%VER_LAMEXP_TYPE%" == "Alpha" set "VER_LAMEXP_BASENAME=LameXP-ALPHA"
|
||||||
|
if "%VER_LAMEXP_TYPE%" == "Beta" set "VER_LAMEXP_BASENAME=LameXP-BETA"
|
||||||
REM ------------------------------------------
|
REM ------------------------------------------
|
||||||
echo LameXP Version:
|
echo LameXP Version:
|
||||||
echo %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%, Build #%VER_LAMEXP_BUILD% (%VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%)
|
echo %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%, Build #%VER_LAMEXP_BUILD% (%VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%)
|
||||||
|
@ -3016,22 +3016,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>QApplication</name>
|
<name>QApplication</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="810"/>
|
<location filename="../../src/Global.cpp" line="816"/>
|
||||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1053"/>
|
<location filename="../../src/Global.cpp" line="1059"/>
|
||||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1058"/>
|
<location filename="../../src/Global.cpp" line="1064"/>
|
||||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1071"/>
|
<location filename="../../src/Global.cpp" line="1077"/>
|
||||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -3016,22 +3016,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>QApplication</name>
|
<name>QApplication</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="810"/>
|
<location filename="../../src/Global.cpp" line="816"/>
|
||||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||||
<translation type="unfinished">Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.</translation>
|
<translation type="unfinished">Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1053"/>
|
<location filename="../../src/Global.cpp" line="1059"/>
|
||||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||||
<translation type="unfinished">Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
|
<translation type="unfinished">Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1058"/>
|
<location filename="../../src/Global.cpp" line="1064"/>
|
||||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||||
<translation type="unfinished">Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".</translation>
|
<translation type="unfinished">Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1071"/>
|
<location filename="../../src/Global.cpp" line="1077"/>
|
||||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||||
<translation type="unfinished">Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
|
<translation type="unfinished">Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -3016,22 +3016,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>QApplication</name>
|
<name>QApplication</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="810"/>
|
<location filename="../../src/Global.cpp" line="816"/>
|
||||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||||
<translation>EXE-filen '%1' stöder inte Windows kompatibilitetsläge.</translation>
|
<translation>EXE-filen '%1' stöder inte Windows kompatibilitetsläge.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1053"/>
|
<location filename="../../src/Global.cpp" line="1059"/>
|
||||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||||
<translation>EXE-filen '%1' kräver Qt v%2, du har Qt v%3.</translation>
|
<translation>EXE-filen '%1' kräver Qt v%2, du har Qt v%3.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1058"/>
|
<location filename="../../src/Global.cpp" line="1064"/>
|
||||||
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
<source>Executable '%1' was built for Qt '%2', but found Qt '%3'.</source>
|
||||||
<translation>EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.</translation>
|
<translation>EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Global.cpp" line="1071"/>
|
<location filename="../../src/Global.cpp" line="1077"/>
|
||||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||||
<translation>EXE-filen '%1' kräver Windows 2000 eller senare.</translation>
|
<translation>EXE-filen '%1' kräver Windows 2000 eller senare.</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 5
|
#define VER_LAMEXP_MINOR_LO 5
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 5
|
#define VER_LAMEXP_PATCH 5
|
||||||
#define VER_LAMEXP_BUILD 1038
|
#define VER_LAMEXP_BUILD 1040
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tool versions (minimum expected versions!)
|
// Tool versions (minimum expected versions!)
|
||||||
|
@ -1125,7 +1125,7 @@ bool MainWindow::winEvent(MSG *message, long *result)
|
|||||||
*/
|
*/
|
||||||
void MainWindow::windowShown(void)
|
void MainWindow::windowShown(void)
|
||||||
{
|
{
|
||||||
QStringList arguments = QApplication::arguments();
|
const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
|
||||||
|
|
||||||
//First run?
|
//First run?
|
||||||
bool firstRun = false;
|
bool firstRun = false;
|
||||||
|
@ -63,6 +63,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
|
//Shell API
|
||||||
|
#include <Shellapi.h>
|
||||||
|
|
||||||
//COM includes
|
//COM includes
|
||||||
#include <Objbase.h>
|
#include <Objbase.h>
|
||||||
#include <PowrProf.h>
|
#include <PowrProf.h>
|
||||||
@ -258,6 +261,9 @@ static const DWORD g_main_thread_id = GetCurrentThreadId();
|
|||||||
//Log file
|
//Log file
|
||||||
static FILE *g_lamexp_log_file = NULL;
|
static FILE *g_lamexp_log_file = NULL;
|
||||||
|
|
||||||
|
//CLI Arguments
|
||||||
|
static QStringList *g_lamexp_argv = NULL;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// GLOBAL FUNCTIONS
|
// GLOBAL FUNCTIONS
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -536,7 +542,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
|||||||
/*
|
/*
|
||||||
* Initialize the console
|
* Initialize the console
|
||||||
*/
|
*/
|
||||||
void lamexp_init_console(int argc, char* argv[])
|
void lamexp_init_console(const QStringList &argv)
|
||||||
{
|
{
|
||||||
bool enableConsole = lamexp_version_demo();
|
bool enableConsole = lamexp_version_demo();
|
||||||
|
|
||||||
@ -561,13 +567,13 @@ void lamexp_init_console(int argc, char* argv[])
|
|||||||
|
|
||||||
if(!LAMEXP_DEBUG)
|
if(!LAMEXP_DEBUG)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < argc; i++)
|
for(int i = 0; i < argv.count(); i++)
|
||||||
{
|
{
|
||||||
if(!_stricmp(argv[i], "--console"))
|
if(!argv.at(i).compare("--console", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
enableConsole = true;
|
enableConsole = true;
|
||||||
}
|
}
|
||||||
else if(!_stricmp(argv[i], "--no-console"))
|
else if(!argv.at(i).compare("--no-console", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
enableConsole = false;
|
enableConsole = false;
|
||||||
}
|
}
|
||||||
@ -1683,6 +1689,31 @@ bool lamexp_install_translator_from_file(const QString &qmFile)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QStringList &lamexp_arguments(void)
|
||||||
|
{
|
||||||
|
if(!g_lamexp_argv)
|
||||||
|
{
|
||||||
|
g_lamexp_argv = new QStringList();
|
||||||
|
int nArgs = 0;
|
||||||
|
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
||||||
|
|
||||||
|
if(NULL != szArglist)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < nArgs; i++)
|
||||||
|
{
|
||||||
|
*g_lamexp_argv << WCHAR2QSTR(szArglist[i]);
|
||||||
|
}
|
||||||
|
LocalFree(szArglist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("CommandLineToArgvW failed !!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *g_lamexp_argv;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate known folder on local system
|
* Locate known folder on local system
|
||||||
*/
|
*/
|
||||||
@ -2100,6 +2131,9 @@ void lamexp_finalization(void)
|
|||||||
fclose(g_lamexp_log_file);
|
fclose(g_lamexp_log_file);
|
||||||
g_lamexp_log_file = NULL;
|
g_lamexp_log_file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Free CLI Arguments
|
||||||
|
LAMEXP_DELETE(g_lamexp_argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -104,7 +104,7 @@ DWORD lamexp_get_os_version(void);
|
|||||||
bool lamexp_detect_wine(void);
|
bool lamexp_detect_wine(void);
|
||||||
|
|
||||||
//Public functions
|
//Public functions
|
||||||
void lamexp_init_console(int argc, char* argv[]);
|
void lamexp_init_console(const QStringList &argv);
|
||||||
bool lamexp_init_qt(int argc, char* argv[]);
|
bool lamexp_init_qt(int argc, char* argv[]);
|
||||||
int lamexp_init_ipc(void);
|
int lamexp_init_ipc(void);
|
||||||
LONG WINAPI lamexp_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
|
LONG WINAPI lamexp_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||||
@ -124,6 +124,7 @@ bool lamexp_portable_mode(void);
|
|||||||
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
|
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
|
||||||
bool lamexp_is_hibernation_supported(void);
|
bool lamexp_is_hibernation_supported(void);
|
||||||
QIcon lamexp_app_icon(const QDate *date = NULL, const QTime *time = NULL);
|
QIcon lamexp_app_icon(const QDate *date = NULL, const QTime *time = NULL);
|
||||||
|
const QStringList &lamexp_arguments(void);
|
||||||
|
|
||||||
//Translation support
|
//Translation support
|
||||||
QStringList lamexp_query_translations(void);
|
QStringList lamexp_query_translations(void);
|
||||||
|
@ -50,8 +50,11 @@ static int lamexp_main(int argc, char* argv[])
|
|||||||
int iShutdown = shutdownFlag_None;
|
int iShutdown = shutdownFlag_None;
|
||||||
bool bAccepted = true;
|
bool bAccepted = true;
|
||||||
|
|
||||||
|
//Get CLI arguments
|
||||||
|
const QStringList &arguments = lamexp_arguments();
|
||||||
|
|
||||||
//Init console
|
//Init console
|
||||||
lamexp_init_console(argc, argv);
|
lamexp_init_console(arguments);
|
||||||
|
|
||||||
//Print version info
|
//Print version info
|
||||||
qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build());
|
qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build());
|
||||||
@ -73,9 +76,9 @@ static int lamexp_main(int argc, char* argv[])
|
|||||||
|
|
||||||
//Enumerate CLI arguments
|
//Enumerate CLI arguments
|
||||||
qDebug("Command-Line Arguments:");
|
qDebug("Command-Line Arguments:");
|
||||||
for(int i = 0; i < argc; i++)
|
for(int i = 0; i < arguments.count(); i++)
|
||||||
{
|
{
|
||||||
qDebug("argv[%d]=%s", i, argv[i]);
|
qDebug("argv[%d]=%s", i, arguments.at(i).toUtf8().constData());
|
||||||
}
|
}
|
||||||
qDebug("");
|
qDebug("");
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ void MessageProducerThread::run()
|
|||||||
{
|
{
|
||||||
setTerminationEnabled(true);
|
setTerminationEnabled(true);
|
||||||
bool bSentFiles = false;
|
bool bSentFiles = false;
|
||||||
QStringList arguments = QApplication::arguments();
|
const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
|
||||||
|
|
||||||
for(int i = 0; i < arguments.count(); i++)
|
for(int i = 0; i < arguments.count(); i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user