From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: [ANN] List_Image v0.2.0
Date: Thu, 1 Feb 2018 17:56:52 -0600
Date: 2018-02-01T17:56:52-06:00 [thread overview]
Message-ID: <p509g4$nt5$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 1b89075d-c284-4358-93b9-704e4b079292@googlegroups.com
<briot.emmanuel@gmail.com> wrote in message
news:1b89075d-c284-4358-93b9-704e4b079292@googlegroups.com...
...
> Apparently, it has no publicly available entity that would provide that
> information,
> either, so a lot of projects simply do:
>
> Is_Windows : constant Boolean :=
> GNAT.OS_Lib.Directory_Separator := '\';
>
> Does Janus/Ada have a similar directory_separator somewhere ?
It's in the body of Ada.Directories -- not very useful.
You could test the case of the file system
(Ada.Directories.Name_Case_Equivalence), Unix/Linux is always
Case_Insensitive. Windows is Case_Preserving unless you are running a POSIX
file system -- but then you probably would want POSIX line terminators, too.
>Seems like this kind of constant should be standard somewhere. Claiming Ada
>code is portable is nice (and
> mostly true), but I believe almost all multi-platform projects end up
> with such a
> requirement, in practice, if only to properly handle file names.
> If thought Ada.Directories might help here, but apparently not.
The idea of Ada.Directories is that you do all of the file handling through
it, and you never need to worry about path separators. (Systems like VMS use
more than a single character.) Similarly, if you do all of your text file
writing with Text_IO, you use New_Line and it does the right thing. Assuming
a single character or string is involved is limiting.
If one has a string with multiple lines, it makes the most sense (for
portable code) to use anything that makes sense, but then use multiple
Put_Lines to write it (not just one) so that any sort of separator
(including just a <CR> as on original Macs or some sort of record separator
aas on some ancient mainframes) will work.
If you just care about Linux and Windows and don't think anything else will
ever be used (possible, I guess), then test Name_Case_Equivalence and be
happy. :-)
Randy.
next prev parent reply other threads:[~2018-02-01 23:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 0:44 [ANN] List_Image v0.2.0 Lionel Draghi
2018-01-31 7:27 ` briot.emmanuel
2018-01-31 21:11 ` Lionel Draghi
2018-02-01 8:05 ` briot.emmanuel
2018-02-01 9:48 ` J-P. Rosen
2018-02-01 15:48 ` Lionel Draghi
2018-02-01 17:20 ` bozovic.bojan
2018-02-01 18:31 ` Lionel Draghi
2018-02-01 18:45 ` bozovic.bojan
2018-02-01 20:26 ` Dennis Lee Bieber
2018-02-02 5:25 ` J-P. Rosen
2018-02-02 0:02 ` Randy Brukardt
2018-02-02 0:31 ` Simon Clubley
2018-02-02 18:34 ` Lionel Draghi
2018-02-02 22:40 ` Randy Brukardt
2018-02-11 23:27 ` Lionel Draghi
2018-02-12 6:55 ` J-P. Rosen
2018-02-12 20:44 ` Lionel Draghi
2018-02-12 10:57 ` Stefan.Lucks
2018-02-12 21:41 ` Lionel Draghi
2018-03-07 10:17 ` Semantic versioning (Was: [ANN] List_Image v0.2.0) Jacob Sparre Andersen
2018-02-01 20:11 ` [ANN] List_Image v0.2.0 J-P. Rosen
2018-02-01 21:08 ` Simon Wright
2018-02-01 0:27 ` Randy Brukardt
2018-02-01 7:55 ` briot.emmanuel
2018-02-01 23:56 ` Randy Brukardt [this message]
2018-02-02 15:48 ` Simon Wright
2018-02-02 22:54 ` Randy Brukardt
2018-02-01 8:08 ` Simon Wright
2018-02-01 8:24 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox