From b675289f68ae0f781051dbdd7dd499e64a7a4ec4 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Mon, 2 Feb 2009 01:18:21 +0000 Subject: [PATCH] Provide local implementation of the GNU variant of basename() under Windows. --- src/lsa.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lsa.cc b/src/lsa.cc index 4a0a9f32..8c380c13 100644 --- a/src/lsa.cc +++ b/src/lsa.cc @@ -131,6 +131,23 @@ Entry::Entry( File::Class & f ) read * sizeof( uint16_t ) ); } +#ifdef __WIN32 + +// Win32 features the usual Posix basename() which may modify its input. We +// provide our local implementation here instead. + +char const * basename( char const * n ) +{ + char const * lastSep = strrchr( n, '\\' ); + + if ( !lastSep ) + return n; + + return lastSep + 1; +} + +#endif + class LsaDictionary: public BtreeIndexing::BtreeDictionary { File::Class idx;