View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006491 | FPC | RTL | public | 2005-12-12 12:00 | 2006-06-22 15:55 |
Reporter | FPC core team | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
OS | Win32 | ||||
Product Version | 2.0.2 | ||||
Fixed in Version | 2.2.0 | ||||
Summary | 0006491: SysUtils.ExtractFileDrive inconsistent with Delphi | ||||
Description | 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 ''. CheckEquals( '', tiUtils.tiRemoveDrive('c:'), 'Failed on 1' ); | ||||
Additional Information | Reporter: Graeme Geldenhuys EMail: graeme at mastermaths dot co dot za | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 3560 | ||||
FPCOldBugId | 4585 | ||||
FPCTarget | |||||
Attached Files |
|
2005-12-12 12:00
|
code.pp (657 bytes)
-------------- 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 -------------------- I think the first if statement of [fina.inc] ExtractFileDrive should be change to test if (Length(FileName) >= 2) and ... instead of if (Length(FileName) >= 3) and ... |
|
Sorry, I never gave a complete test application in the original bug report. Please see the attached TestExtractDrive.lpr file for an example showing the bug. ------------ Under FPC 2.0.2 on Linux ---------------- graemeg@porky:~/Programming/Tests/ExtractDrive$ ./TestExtractDrive Start tests... Failed on 1: Expected <> but found <c:> ...test passed. ...test passed. ...test passed. Failed on 5: Expected <c:> but found <> ...test passed. ...test passed. ...test passed. Done. ---------------------- END -------------------------- ------------ Under Delphi 7 on Win2000 --------------- c:\Programming\Tests\extractdrive>testextractdrive Start tests... ...test passed. ...test passed. ...test passed. ...test passed. ...test passed. ...test passed. ...test passed. ...test passed. Done. ---------------------- END -------------------------- To fix the problem I believe the following needs to be done. The first if statement of [fina.inc] ExtractFileDrive should be change to test if (Length(FileName) >= 2) and [....] instead of if (Length(FileName) >= 3) and [....] |
2006-05-18 14:36
|
|
|
Fixed, reworked procedure so it is more efficient. Please test again. |
Date Modified | Username | Field | Change |
---|---|---|---|
2006-05-18 09:39 | Michael Van Canneyt | Status | new => assigned |
2006-05-18 09:39 | Michael Van Canneyt | Assigned To | => Michael Van Canneyt |
2006-05-18 14:35 | Graeme Geldenhuys | Note Added: 0007777 | |
2006-05-18 14:36 | Graeme Geldenhuys | File Added: TestExtractDrive.lpr | |
2006-05-18 14:48 | Michael Van Canneyt | Fixed in Revision | => 3560 |
2006-05-18 14:48 | Michael Van Canneyt | Status | assigned => resolved |
2006-05-18 14:48 | Michael Van Canneyt | Fixed in Version | => 2.1.1 |
2006-05-18 14:48 | Michael Van Canneyt | Resolution | open => fixed |
2006-05-18 14:48 | Michael Van Canneyt | Note Added: 0007778 | |
2006-06-22 15:55 | Florian | Status | resolved => closed |