[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] system-type cygwin with window-system w32
From: |
Daniel Colascione |
Subject: |
Re: [PATCH] system-type cygwin with window-system w32 |
Date: |
Mon, 18 Jul 2011 00:01:30 -0700 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
On 7/17/11 11:53 PM, Eli Zaretskii wrote:
> Could you please explain this part of the patch:
>
>> /* Create the dialog with PROMPT as title, using DIR as initial
>> directory and using "*" as pattern. */
>> - dir = Fexpand_file_name (dir, Qnil);
>> - strncpy (init_dir, SDATA (ENCODE_FILE (dir)), MAX_PATH);
>> - init_dir[MAX_PATH] = '\0';
>> - unixtodos_filename (init_dir);
>> -
>> - if (STRINGP (default_filename))
>> - {
>> - char *file_name_only;
>> - char *full_path_name = SDATA (ENCODE_FILE (default_filename));
>> -
>> - unixtodos_filename (full_path_name);
>> -
>> - file_name_only = strrchr (full_path_name, '\\');
>> - if (!file_name_only)
>> - file_name_only = full_path_name;
>> - else
>> - file_name_only++;
>> -
>> - strncpy (filename, file_name_only, MAX_PATH);
>> - filename[MAX_PATH] = '\0';
>> - }
>> - else
>> - filename[0] = '\0';
>> -
>> - /* The code in file_dialog_callback that attempts to set the text
>> - of the file name edit window when handling the CDN_INITDONE
>> - WM_NOTIFY message does not work. Setting filename to "Current
>> - Directory" in the only_dir_p case here does work however. */
>> - if (filename[0] == 0 && ! NILP (only_dir_p))
>> - strcpy (filename, "Current Directory");
>> + to_unicode (Fexpand_file_name (dir, Qnil), &dir);
>> +
>> + to_unicode (build_string ("All Files (*.*)\0*.*\0Directories\0*|*\0\0"),
>> + &filter);
>
> AFAICT, to_unicode encodes the file name in UTF-16. If so, this will
> not work in the native Windows build, because it does not use Unicode
> APIs for file names.
Not today, no.
> In the original code, ENCODE_FILE would use the
> ANSI encoding, not UTF-16. So, unless I'm missing something, the
> replacement is not equivalent to the original, and could break the
> native build.
Yes, the change would make Emacs Unicode-only --- but every Windows OS
in common use supports unicode. Why would requiring unicode support be
a problem? IIUC, Unicode is strictly a superset of all the single-byte
encoding schemes supported by Windows.
> If my analysis is correct, could you please explain the rationale for
> this change?
The change needed to be made anyway --- we need to translate between NT
and Cygwin paths now --- so why not transition to unicode at the same
time? (I want to stub out the path conversion functions for native NT
builds.)
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH] system-type cygwin with window-system w32, (continued)
Re: [PATCH] system-type cygwin with window-system w32, Eli Zaretskii, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32,
Daniel Colascione <=
- Re: [PATCH] system-type cygwin with window-system w32, Eli Zaretskii, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Daniel Colascione, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Eli Zaretskii, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Daniel Colascione, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Juanma Barranquero, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Eli Zaretskii, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Daniel Colascione, 2011/07/18
- Re: [PATCH] system-type cygwin with window-system w32, Eli Zaretskii, 2011/07/18
Re: [PATCH] system-type cygwin with window-system w32, Richard Stallman, 2011/07/18
Re: [PATCH] system-type cygwin with window-system w32, Richard Stallman, 2011/07/18