More carefully check TEMP directory + fix fatal application exit.
This commit is contained in:
parent
1633489aaf
commit
2ea5e07d6e
@ -16,9 +16,7 @@ if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
|||||||
echo ----------------------------------------------------------------
|
echo ----------------------------------------------------------------
|
||||||
set "LAMEXP_ERROR=1"
|
set "LAMEXP_ERROR=1"
|
||||||
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:detailed %1
|
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:detailed %1
|
||||||
if not "%ERRORLEVEL%"=="0" (
|
|
||||||
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Build /verbosity:detailed %1
|
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Build /verbosity:detailed %1
|
||||||
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
||||||
)
|
|
||||||
echo ----------------------------------------------------------------
|
echo ----------------------------------------------------------------
|
||||||
set "LAMEXP_ERROR=0"
|
set "LAMEXP_ERROR=0"
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#define VER_LAMEXP_MAJOR 4
|
#define VER_LAMEXP_MAJOR 4
|
||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 0
|
#define VER_LAMEXP_MINOR_LO 0
|
||||||
#define VER_LAMEXP_BUILD 49
|
#define VER_LAMEXP_BUILD 50
|
||||||
#define VER_LAMEXP_SUFFIX TechPreview
|
#define VER_LAMEXP_SUFFIX TechPreview
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -201,7 +201,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||||
fprintf(stderr, "\nCRITICAL ERROR !!!\n%s\n\n", msg);
|
fprintf(stderr, "\nCRITICAL ERROR !!!\n%s\n\n", msg);
|
||||||
MessageBoxA(NULL, msg, "LameXP - CRITICAL ERROR", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
|
MessageBoxW(NULL, (wchar_t*) QString::fromUtf8(msg).utf16(), L"LameXP - CRITICAL ERROR", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||||
@ -219,6 +219,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
|||||||
|
|
||||||
if(type == QtCriticalMsg || type == QtFatalMsg)
|
if(type == QtCriticalMsg || type == QtFatalMsg)
|
||||||
{
|
{
|
||||||
|
lock.unlock();
|
||||||
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
|
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
|
||||||
TerminateProcess(GetCurrentProcess(), -1);
|
TerminateProcess(GetCurrentProcess(), -1);
|
||||||
}
|
}
|
||||||
@ -538,20 +539,43 @@ const QString &lamexp_temp_folder(void)
|
|||||||
{
|
{
|
||||||
if(g_lamexp_temp_folder.isEmpty())
|
if(g_lamexp_temp_folder.isEmpty())
|
||||||
{
|
{
|
||||||
QDir tempFolder(QDir::tempPath());
|
QDir temp = QDir::temp();
|
||||||
QString uuid = QUuid::createUuid().toString();
|
|
||||||
tempFolder.mkdir(uuid);
|
|
||||||
|
|
||||||
if(tempFolder.cd(uuid))
|
if(!temp.exists())
|
||||||
{
|
{
|
||||||
g_lamexp_temp_folder = tempFolder.canonicalPath();
|
temp.mkpath(".");
|
||||||
}
|
if(!temp.exists())
|
||||||
else
|
|
||||||
{
|
{
|
||||||
g_lamexp_temp_folder = QDir::tempPath();
|
qFatal("The system's temporary directory does not exist:\n%s", temp.canonicalPath().toUtf8().constData());
|
||||||
|
return g_lamexp_temp_folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString uuid = QUuid::createUuid().toString();
|
||||||
|
if(!temp.mkdir(uuid))
|
||||||
|
{
|
||||||
|
qFatal("Temporary directory could not be created:\n%s", QString("%1/%2").arg(temp.canonicalPath(), uuid).toUtf8().constData());
|
||||||
|
return g_lamexp_temp_folder;
|
||||||
|
}
|
||||||
|
if(!temp.cd(uuid))
|
||||||
|
{
|
||||||
|
qFatal("Temporary directory could not be entered:\n%s", QString("%1/%2").arg(temp.canonicalPath(), uuid).toUtf8().constData());
|
||||||
|
return g_lamexp_temp_folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile testFile(QString("%1/~test.txt").arg(temp.canonicalPath()));
|
||||||
|
if(!testFile.open(QIODevice::ReadWrite) || testFile.write("LAMEXP_TEST\n") < 12)
|
||||||
|
{
|
||||||
|
qFatal("Write access to temporary directory has been denied:\n%s", temp.canonicalPath().toUtf8().constData());
|
||||||
|
return g_lamexp_temp_folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
testFile.close();
|
||||||
|
QFile::remove(testFile.fileName());
|
||||||
|
|
||||||
|
g_lamexp_temp_folder = temp.canonicalPath();
|
||||||
|
}
|
||||||
|
|
||||||
return g_lamexp_temp_folder;
|
return g_lamexp_temp_folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user