#1 2020-11-04 02:34:41

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Problem with GetDiskPartitionsText

Hi Arnaud,
Just letting you know of a potential bug in GetDiskPartitionsText (SynTable.pas)
The windows version seems to be ignoring the "withfreespace" parameter...

   function GetInfo(var p: TDiskPartition): shortstring;
   var av, fr, tot: QWord;
   begin
     if not withfreespace or not GetDiskInfo(p.mounted,av,fr,tot) then
       {$ifdef MSWINDOWS}
       FormatShort('%: % (%)',[p.mounted[1],p.name,KB(p.size,nospace)],result) else
       FormatShort(F[nospace],[p.mounted[1],p.name,KB(p.size,nospace)],result);           <===== doesn't include disk free space values
       {$else}
       FormatShort('% % (%)',[p.mounted,p.name,KB(p.size,nospace)],result) else
       FormatShort(F[nospace],[p.mounted,p.name,KB(fr,nospace),KB(tot,nospace)],result);
       {$endif}
   end;

I tried changing the MSWINDOWS version to be the same as non-windows ...

FormatShort(F[nospace],[p.mounted,p.name,KB(fr,nospace),KB(tot,nospace)],result);

and all seems to work OK

Offline

#2 2020-11-04 17:12:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,603
Website

Re: Problem with GetDiskPartitionsText

Please try https://synopse.info/fossil/info/dc2ac37a4e

Thanks for the feedback!

Offline

Board footer

Powered by FluxBB