[fpc-devel] SysUtils.ExtractFileDrive inconsistent

Graeme Geldenhuys graeme at mastermaths.co.za
Fri Dec 9 09:24:41 CET 2005


Hi

I am busy porting a Delphi application to Free Pascal & Lazarus. 
Luckily I have a 1400 unit tests to help me along.  Running the 
following unit test under Lazarus & Delphi produces different results! 
It fails under Free Pascal.  I traced the difference to the 
ExtractFileDrive call.  Under Delphi it returns 'c:' and under FPC it 
returns ''.  This was all run under Windows 2000 and FPC 2.0.1


CheckEquals( '', tiUtils.tiRemoveDrive('c:'), 'Failed on 1' );


--------------  CUT  --------------------
function tiRemoveDrive( pStrPath : string ) : string ;
var
   sDrive : string ;
begin
   sDrive := extractFileDrive( pStrPath ) ;
   if sDrive <> '' then begin
     result := copy( pStrPath, length( sDrive )+1, length( pStrPath ) -
                     length( sDrive )) ;
   end else begin
     result := pStrPath ;
   end ;
end ;
--------------  CUT  --------------------


Regards,
   - Graeme -






More information about the fpc-devel mailing list