Small improvement in lamexp_finalization() function.
This commit is contained in:
parent
4590cd223a
commit
c878013200
@ -1619,6 +1619,8 @@ const QString &lamexp_temp_folder2(void)
|
||||
bool lamexp_clean_folder(const QString &folderPath)
|
||||
{
|
||||
QDir tempFolder(folderPath);
|
||||
if(tempFolder.exists())
|
||||
{
|
||||
QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||
|
||||
for(int i = 0; i < entryList.count(); i++)
|
||||
@ -1638,9 +1640,9 @@ bool lamexp_clean_folder(const QString &folderPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tempFolder.rmdir(".");
|
||||
return !tempFolder.exists();
|
||||
return tempFolder.rmdir(".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2944,13 +2946,20 @@ void lamexp_finalization(void)
|
||||
{
|
||||
if(!g_lamexp_temp_folder.path->isEmpty())
|
||||
{
|
||||
bool success = false;
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
if(lamexp_clean_folder(*g_lamexp_temp_folder.path))
|
||||
{
|
||||
success = true;
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user