[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix 'dirname' and 'basename' on MS-Windows
From: |
Ludovic Courtès |
Subject: |
Re: Fix 'dirname' and 'basename' on MS-Windows |
Date: |
Wed, 09 Jul 2014 16:22:02 +0200 |
User-agent: |
Gnus/5.130009 (Ma Gnus v0.9) Emacs/24.3 (gnu/linux) |
Eli Zaretskii <address@hidden> skribis:
> These 2 functions don't deal correctly with Windows file names with
> drive letters and with UNCs. The patch below fixes that.
>
> Incidentally, isn't the line in scm_basename marked below wrong?
>
> if (i == end)
> {
> if (len > 0 && is_file_name_separator (scm_c_string_ref (filename, 0)))
> return scm_c_substring (filename, 0, 1);
> else
> return scm_dot_string; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> }
> else
> return scm_c_substring (filename, i+1, end+1);
>
> It is responsible for the following strange results:
>
> (basename ".foo" ".foo") => "."
> (basename "_foo" "_foo") => "."
>
> Also, isn't the following result wrong as well?
>
> (basename "/") => "/"
>
> I think all of these should return the empty string, "".
(I think I forgot about this message, sorry.)
It seems that Gnulib’s dirname-lgpl and basename-lgpl modules do what
you want. Could you confirm?
If that’s the case, I’ll import them. If you want to commit
Window-specific tests, that’s even better.
Thanks,
Ludo’.
- Re: Windows file name separators, (continued)
- Re: Windows file name separators, Ludovic Courtès, 2014/07/01
- Re: Windows file name separators, Eli Zaretskii, 2014/07/02
- Re: Windows file name separators, Ludovic Courtès, 2014/07/02
- Re: Windows file name separators, Ludovic Courtès, 2014/07/02
- Re: Windows file name separators, Eli Zaretskii, 2014/07/03
- Re: Windows file name separators, Ludovic Courtès, 2014/07/03
- Re: Windows file name separators, Eli Zaretskii, 2014/07/03
- Re: Windows file name separators, Mark H Weaver, 2014/07/07
- Re: Windows file name separators, Eli Zaretskii, 2014/07/07
- Fix 'dirname' and 'basename' on MS-Windows, Eli Zaretskii, 2014/07/02
- Re: Fix 'dirname' and 'basename' on MS-Windows,
Ludovic Courtès <=
- Re: Fix 'dirname' and 'basename' on MS-Windows, Eli Zaretskii, 2014/07/09
- Provide reasonable stack limit on MS-Windows, Eli Zaretskii, 2014/07/02
- Re: Provide reasonable stack limit on MS-Windows, Ludovic Courtès, 2014/07/02
- Re: Provide reasonable stack limit on MS-Windows, Eli Zaretskii, 2014/07/03
- Bug in scm_getaffinity, Eli Zaretskii, 2014/07/02
- Re: Bug in scm_getaffinity, Ludovic Courtès, 2014/07/02
- Re: Bug in scm_getaffinity, Eli Zaretskii, 2014/07/03