Home Linux path utils
Reply: 1

Linux path utils

aQuu
1#
aQuu Published in 2018-02-08 14:04:11Z

Im working on windows, and I want to prepare linux path string. There are many useful mathods in TPath, so I made this (it doesn't work):

uses
{$DEFINE POSIX}
    System.IOUtils;
{$UNDEF POSIX}
type
    TPosixPath = TPath;

I wanted do same thing with System.SysUtils to use e.g IncludeTrailingPathDelimiter but both don't work. Any idea how use those units in linux way? Or another idea for manipulate linux strings paths using existing units?

David Heffernan
2#
David Heffernan Reply to 2018-02-08 14:37:49Z

That does not work because the POSIX conditional is used when the unit is compiled and not when it is used.

In order to prepare a POSIX path on a non-POSIX system you are going to have to prepare some bespoke methods. You can use the IOUtils unit as a guide although be warned that unit has a few wrinkles. Try not to transcribe any design flaws in your own variants.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311835 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO