Small improvement in lamexp_finalization() function.

This commit is contained in:
LoRd_MuldeR 2013-10-12 20:33:13 +02:00
parent 4590cd223a
commit c878013200

View File

@ -1619,6 +1619,8 @@ const QString &lamexp_temp_folder2(void)
bool lamexp_clean_folder(const QString &folderPath) bool lamexp_clean_folder(const QString &folderPath)
{ {
QDir tempFolder(folderPath); QDir tempFolder(folderPath);
if(tempFolder.exists())
{
QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot); QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
for(int i = 0; i < entryList.count(); i++) for(int i = 0; i < entryList.count(); i++)
@ -1638,9 +1640,9 @@ bool lamexp_clean_folder(const QString &folderPath)
} }
} }
} }
return tempFolder.rmdir(".");
tempFolder.rmdir("."); }
return !tempFolder.exists(); return true;
} }
/* /*
@ -2944,13 +2946,20 @@ void lamexp_finalization(void)
{ {
if(!g_lamexp_temp_folder.path->isEmpty()) if(!g_lamexp_temp_folder.path->isEmpty())
{ {
bool success = false;
for(int i = 0; i < 100; i++) for(int i = 0; i < 100; i++)
{ {
if(lamexp_clean_folder(*g_lamexp_temp_folder.path)) if(lamexp_clean_folder(*g_lamexp_temp_folder.path))
{ {
success = true;
break; break;
} }
Sleep(125); lamexp_sleep(100);
}
if(!success)
{
MessageBoxW(NULL, L"Sorry, LameXP was unable to clean up all temporary files. Some residual files in your TEMP directory may require manual deletion!", L"LameXP", MB_ICONEXCLAMATION|MB_TOPMOST);
lamexp_exec_shell(NULL, *g_lamexp_temp_folder.path, QString(), QString(), true);
} }
} }
LAMEXP_DELETE(g_lamexp_temp_folder.path); LAMEXP_DELETE(g_lamexp_temp_folder.path);