Don't stat files twice when sending to trash

TQDir::entryInfoList will call some variation of stat on each file when
creating the return list, so there is no need to stat the file again.

See: TDE/tdebase#445
Signed-off-by: mio <stigma@disroot.org>
pull/542/head
mio 1 month ago
parent 2b6ca04466
commit 425bcff801

@ -52,10 +52,17 @@ unsigned long DiscSpaceUtil::sizeOfPath( const TQString &path )
TQFileInfoListIterator it( *infos );
unsigned long sum = 0;
TQFileInfo *info = 0;
while ( (info = it.current()) != 0 ) {
if ( info->fileName() != "." && info->fileName() != ".." )
sum += sizeOfPath( info->absFilePath() );
const TQFileInfo *info = nullptr;
while ((info = it.current()))
{
if (info->isFile())
{
sum += info->size();
}
else if (info->fileName() != "." && info->fileName() != "..")
{
sum += sizeOfPath(info->absFilePath());
}
++it;
}

Loading…
Cancel
Save