[Lazarus] Multi-platform console application, how to handle file paths?

Bo Berglund bo.berglund at gmail.com
Tue Oct 29 13:07:50 CET 2019


On Tue, 29 Oct 2019 12:43:51 +0100 (CET), Michael Van Canneyt via
lazarus <lazarus at lists.lazarus-ide.org> wrote:

>1. Don't hardcode '/' or '\', use the PathDelim constant instead.
>    You will not need any ifdefs.

The whole thing is that paths might be read from config or other data
files and so they will come in either with / or \.
I cannot use PathDelim in the target spec because that would not find
the erroneous delimiters.

That said, both you and Mehmet pointed out that Windows accepts both
delimiters, which I did not know. I have been around too long so I
remember the old days...

Anyway, given that the delimiters do not matter I will just code for
Linux (the main platform) and not bother with the Windows case.

Thanks for your information!

-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list