Fixed getExecutableName() function.

This commit is contained in:
LoRd_MuldeR 2016-05-15 23:02:32 +02:00
parent 59aed73bf4
commit 6185f67786

View File

@ -189,17 +189,17 @@ static QString getExecutableName(int &argc, char **argv)
if(argc >= 1) if(argc >= 1)
{ {
const char *argv0 = argv[0]; const char *argv0 = argv[0];
if(const char *const ptr = strrchr(argv0, '/')) for (int i = 0; i < 2; i++)
{
static const char SEP[2] = { '/', '\\' };
if (const char *const ptr = strrchr(argv0, SEP[i]))
{ {
argv0 = ptr + 1; argv0 = ptr + 1;
} }
if(const char *const ptr = strrchr(argv0, '\\'))
{
argv0 = ptr + 1;
} }
if(strlen(argv0) > 1) if(strlen(argv0) > 1)
{ {
QString::fromLatin1(argv0); return QString::fromLatin1(argv0);
} }
} }
return QLatin1String("Program.exe"); return QLatin1String("Program.exe");
@ -255,11 +255,11 @@ QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString &
//Check whether we are running on a supported Windows version //Check whether we are running on a supported Windows version
if(const char *const friendlyName = MUtils::OS::os_friendly_name(osVersion)) if(const char *const friendlyName = MUtils::OS::os_friendly_name(osVersion))
{ {
qDebug("Running on %s (NT v%u.%u).\n", friendlyName, osVersion.versionMajor, osVersion.versionMinor); qDebug("Running on %s (NT v%u.%u.%u).\n", friendlyName, osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild);
} }
else else
{ {
const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (v%u.%u).", osVersion.versionMajor, osVersion.versionMinor); const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (v%u.%u.%u).", osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild);
qWarning("%s\n", MUTILS_UTF8(message)); qWarning("%s\n", MUTILS_UTF8(message));
MUtils::OS::system_message_wrn(L"LameXP", MUTILS_WCHR(message)); MUtils::OS::system_message_wrn(L"LameXP", MUTILS_WCHR(message));
} }