English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Bug in Filename.basename?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-09-05 (08:45)
From: Erik de Castro Lopo <mle+ocaml@m...>
Subject: Bug in Filename.basename?
Hi all,

I think I have found a bug in the above function.
        Objective Caml version 3.10.0

    # let x = Filename.basename "a/b/c" ;;
    val x : string = "c"
    # let x = Filename.basename "a/b/c/" ;;
    val x : string = "."

The first result is fine, but second result is definitely not what
one would reasonably expect.

For instance, the basename program in Linux gives:

    > basename a/b/c/


Erik de Castro Lopo
"C++ is a language strongly optimized for liars and people who
go by guesswork and ignorance." -- Erik Naggum