]> git.wh0rd.org - fontconfig.git/commitdiff
When canonizing filenames, squash // and remove final / (#bug 16286)
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 12 Aug 2008 19:10:04 +0000 (15:10 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 14 Feb 2009 00:53:54 +0000 (16:53 -0800)
The fact that we now drop final slashes from all filenames without
checking that the file name represents a directory may surprise some,
but it doesn't bother me really.

src/fcstr.c

index f56f823bc2f99a0c5600e60ad4cd9b62c3808767..712e23b8c2dfb21e95c98fa0948f2b4c1e4e3aa0 100644 (file)
@@ -902,6 +902,9 @@ FcStrCanonAbsoluteFilename (const FcChar8 *s)
            if (slash)
            {
                switch (s - slash) {
+               case 1:
+                   f -= 1;     /* squash // and trim final / from file */
+                   break;
                case 2:
                    if (!strncmp ((char *) slash, "/.", 2))
                    {