[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] [mingw]: Have compiled-file-name produce valid names.

From: Andy Wingo
Subject: Re: [PATCH 2/5] [mingw]: Have compiled-file-name produce valid names.
Date: Tue, 03 May 2011 09:44:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

On Tue 03 May 2011 00:18, address@hidden (Ludovic Courtès) writes:

>> I still think that we need at least the ability to pass a bytevector as
>> a path name, on GNU systems; and that if we can do so, then any routine
>> that needs to deal with a path name would then need to deal in byte
>> vectors in addition to strings, and at that point perhaps it is indeed
>> useful to have a path library.
> To accommodate various file name encodings, right?  Then yes.

That's the crazy thing: file names on GNU aren't in any encoding!  They
are byte strings that may or may not decode to a string, given some
encoding.  Granted, they're mostly UTF-8 these days, but users have the
darndest files...

> I think GLib and the like expect UTF-8 as the file name encoding and
> complain otherwise, so UTF-8 might be a better default than locale
> encoding (and it’s certainly wiser to be locale-independent.)

It's more complicated than that.  Here's the old interface that they
used, which attempted to treat paths as utf-8:
  (search for "file name encoding")

The new API is abstract, so it allows operations like "get-display-name"
and "get-bytes":  (search for "encoding"
  in that page)

  "All GFiles have a basename (get with g_file_get_basename()). These
  names are byte strings that are used to identify the file on the
  filesystem (relative to its parent directory) and there is no
  guarantees that they have any particular charset encoding or even make
  any sense at all. If you want to use filenames in a user interface you
  should use the display name that you can get by requesting the
  g_file_query_info(). This is guaranteed to be in utf8 and can be used
  in a user interface. But always store the real basename or the GFile
  to use to actually access the file, because there is no way to go from
  a display name to the actual name."

> So volumes matter in the file name canonicalization of the .go cache
> right?
> Couldn’t we mimic /cygdrive/c, etc.?

Is that what cygwin does?  We certainly could, yes; though for the
purposes of joining the cache dir to an absolute filename, I guess we
could simply change c:/foo to /c/foo...  Hum!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]