Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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