Recent

Author Topic: TPath enhancements (Issue #40513): can somebody test with Delphi 12?  (Read 1511 times)

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Hi,

I'm trying to implement the new features that were added in Delphi 12 to TPath.
I've made a naive implementation based upon available documentation.
Some questions about how it is supposed to behave are missing though:

  • The docs state that an exception is raised if the given paths contain invalid characters. Does the value of the ValidateParams have any influence on this?
  • If not: what does this ValidateParams parameter do then?
  • if multiple paths are absolute (e.g. the 2nd, 3rd and 6th path is absolute): what will be returned? (My guess: either the first absolute one it finds, or the last one.)
Could anybody with Delphi 12 test the TPath.Combine(const Paths: array of string; const ValidateParams: Boolean = True): string; function with the test program that is in the bugtracker (https://gitlab.com/freepascal.org/fpc/source/-/issues/40513#note_1645757436)?
Does it behave like the implementation I came up with?
If a parameter is "invalid", but it is not used in the result (e.g. because there is a valid absolute path as the second or later argument in the array), will there be an exception?

Without (black box) testing it'll be impossible to implement these features.

Bart

qubits

  • Newbie
  • Posts: 1
Re: TPath enhancements (Issue #40513): can somebody test with Delphi 12?
« Reply #1 on: November 28, 2023, 08:44:11 pm »
Hi Bart,

Just loaded up D12 few days ago..
Ran the test program, no exceptions generated..
Outputted the following..

Code: Pascal  [Select][+][-]
  1. []: ""
  2. [""]: ""
  3. ["",""]: ""
  4. ["foo","bar"]: "foo\bar"
  5. ["1","2","3"]: "1\2\3"
  6. ["\1","\2","\3"]: "\3"
  7. ["\1","..\2","..\3","..\4"]: "\1\..\2\..\3\..4"
  8. ["\1","","","4","","6",""]: "\1\4\6"
  9. ["","","","|<>"]: "<>|"
  10.  

hope this helps..
good luck.. ~q

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: TPath enhancements (Issue #40513): can somebody test with Delphi 12?
« Reply #2 on: November 28, 2023, 10:53:15 pm »
Just loaded up D12 few days ago..
Ran the test program, no exceptions generated..
Outputted the following..

Code: Pascal  [Select][+][-]
  1. []: ""
  2. [""]: ""
  3. ["",""]: ""
  4. ["foo","bar"]: "foo\bar"
  5. ["1","2","3"]: "1\2\3"
  6. ["\1","\2","\3"]: "\3"
  7. ["\1","..\2","..\3","..\4"]: "\1\..\2\..\3\..4"
  8. ["\1","","","4","","6",""]: "\1\4\6"
  9. ["","","","|<>"]: "<>|"
  10.  

Thanks for testing.
The last one is a bit peculiar (not raising an exception). Other persons have tested this and it seems this happens if the neighbouring path is empty.
After discussiong this with Michael, we concluded that in fact this is/must be a bug in Delphi (as it is extremely illogical) and we raise an exception in this case.
You can checkout fpc main to see how I've implemented it.

If you find other cases where Delphi behaves different than Fpc, please report on the bugtracker.
This way it won't be forgotten, and I can try to fix it (and add the case to the test suite).

Bart

VisualLab

  • Sr. Member
  • ****
  • Posts: 327
Re: TPath enhancements (Issue #40513): can somebody test with Delphi 12?
« Reply #3 on: November 29, 2023, 04:47:46 pm »
I have 2 questions related to the topic:

1. Why TDirectory, TFile and TPath (for FPC) are implemented as classes? In Delphi they are records. Is this caused by:
         a) technical considerations (e.g. compiler limitations)?
         b) for licensing reasons?
         c) for performance reasons?
         d) another cause?

2. From which version of FPC and Lazarus will the System.IOUtils unit be available?

I noticed that documentation for this unit is already available at address: https://www.freepascal.org/daily/packages/vcl-compat/system.ioutils/index-3.html.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: TPath enhancements (Issue #40513): can somebody test with Delphi 12?
« Reply #4 on: December 01, 2023, 10:12:16 pm »
1. Why TDirectory, TFile and TPath (for FPC) are implemented as classes? In Delphi they are records. Is this caused by:
         a) technical considerations (e.g. compiler limitations)?
         b) for licensing reasons?
         c) for performance reasons?
         d) another cause?

I've asked the developer responsible for them cause in fact this makes things incompatible if pointers to the methods are used (method pointers vs. function pointers).

2. From which version of FPC and Lazarus will the System.IOUtils unit be available?

We are currently working on merging the new additions to 3.2.3, so they'll be part of 3.2.4 at least as long as they don't require main specific functionality (e.g. function references or custom attributes).

 

TinyPortal © 2005-2018