Small improvement in lamexp_finalization() function.
This commit is contained in:
parent
4590cd223a
commit
c878013200
@ -1619,28 +1619,30 @@ 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);
|
||||||
QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
if(tempFolder.exists())
|
||||||
|
|
||||||
for(int i = 0; i < entryList.count(); i++)
|
|
||||||
{
|
{
|
||||||
if(entryList.at(i).isDir())
|
QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||||
|
|
||||||
|
for(int i = 0; i < entryList.count(); i++)
|
||||||
{
|
{
|
||||||
lamexp_clean_folder(entryList.at(i).canonicalFilePath());
|
if(entryList.at(i).isDir())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(int j = 0; j < 3; j++)
|
|
||||||
{
|
{
|
||||||
if(lamexp_remove_file(entryList.at(i).canonicalFilePath()))
|
lamexp_clean_folder(entryList.at(i).canonicalFilePath());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
break;
|
if(lamexp_remove_file(entryList.at(i).canonicalFilePath()))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return tempFolder.rmdir(".");
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
tempFolder.rmdir(".");
|
|
||||||
return !tempFolder.exists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user