I've working a little on accessing files and directories using Ada.Directories and have been using a thin wrapper layer to convert from Wide_String to UTF8 and back. It does, however, seem strange there is no Wide_Directories version in the std library. Was there a technical reason it wasn't included?
Take care,
Michael
> Hi,
>
> I've working a little on accessing files and directories using
> Ada.Directories and have been using a thin wrapper layer to convert from
> Wide_String to UTF8 and back.
Does it mean you pass UTF-8 encoded strings to Ada directory operations ?
--
“Syntactic sugar causes cancer of the semi-colons.” [Epigrams on
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
Java: Write once, Never revisit
> Le Fri, 14 Oct 2011 08:58:45 +0200, Michael Rohan
> <michael...@gmail.com> a �crit:
>
>> I've working a little on accessing files and directories using
>> Ada.Directories and have been using a thin wrapper layer to convert from
>> Wide_String to UTF8 and back.
> Does it mean you pass UTF-8 encoded strings to Ada directory operations ?
In most cases this is how it works under Linux. Under Windows that would
depend what kind of operations xA, xW etc the implementation uses.
I would strongly recommend not to use Ada.Directory until it gets fixed,
e.g. *at least* all its calls made Wide_Wide_String or explicitly mandated
as UTF-8 encoded.
Until then as an alternative use GIO binding of Gtk or an equivalent in Qt.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
> On Fri, 14 Oct 2011 09:39:32 +0200, Yannick Duchêne (Hibou57) wrote:
>
>> Le Fri, 14 Oct 2011 08:58:45 +0200, Michael Rohan
>> <michael...@gmail.com> a écrit:
>>
>>> I've working a little on accessing files and directories using
>>> Ada.Directories and have been using a thin wrapper layer to convert
>>> from
>>> Wide_String to UTF8 and back.
>> Does it mean you pass UTF-8 encoded strings to Ada directory operations
>> ?
>
> In most cases this is how it works under Linux. Under Windows that would
> depend what kind of operations xA, xW etc the implementation uses.
This is indeed not safe to use. I get it raising exceptions when facing
file names (perfectly valid file names for the OS), which it did not like
(containing characters outside of ISO-8859). As platform independent, this
package should not impose its own conventions on a platform, so better
avoid it, indeed. It's not safe for a program to fail scanning sanely the
content of a directory when it should be able to (unless its OK for the
program to randomly miss some files).