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 year ago
parent 2b6ca04466
commit 425bcff801

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

Loading…
Cancel
Save