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 ----------------------------------------------------------------
|
||||
set "LAMEXP_ERROR=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
|
||||
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
||||
)
|
||||
msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Build /verbosity:detailed %1
|
||||
if not "%ERRORLEVEL%"=="0" GOTO:EOF
|
||||
echo ----------------------------------------------------------------
|
||||
set "LAMEXP_ERROR=0"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define VER_LAMEXP_MAJOR 4
|
||||
#define VER_LAMEXP_MINOR_HI 0
|
||||
#define VER_LAMEXP_MINOR_LO 0
|
||||
#define VER_LAMEXP_BUILD 49
|
||||
#define VER_LAMEXP_BUILD 50
|
||||
#define VER_LAMEXP_SUFFIX TechPreview
|
||||
|
||||
/*
|
||||
|
@ -201,7 +201,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
fflush(stderr);
|
||||
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
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;
|
||||
case QtWarningMsg:
|
||||
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)
|
||||
{
|
||||
lock.unlock();
|
||||
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
@ -538,18 +539,41 @@ const QString &lamexp_temp_folder(void)
|
||||
{
|
||||
if(g_lamexp_temp_folder.isEmpty())
|
||||
{
|
||||
QDir tempFolder(QDir::tempPath());
|
||||
QString uuid = QUuid::createUuid().toString();
|
||||
tempFolder.mkdir(uuid);
|
||||
QDir temp = QDir::temp();
|
||||
|
||||
if(tempFolder.cd(uuid))
|
||||
if(!temp.exists())
|
||||
{
|
||||
g_lamexp_temp_folder = tempFolder.canonicalPath();
|
||||
temp.mkpath(".");
|
||||
if(!temp.exists())
|
||||
{
|
||||
qFatal("The system's temporary directory does not exist:\n%s", temp.canonicalPath().toUtf8().constData());
|
||||
return g_lamexp_temp_folder;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
QString uuid = QUuid::createUuid().toString();
|
||||
if(!temp.mkdir(uuid))
|
||||
{
|
||||
g_lamexp_temp_folder = QDir::tempPath();
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user