# HG changeset patch # User Rik # Date 1346858077 25200 # Node ID 8bd5c490b787ba5df78a06ab2ca5281aeae4eaaa # Parent 704ab1b4c369f28f5f7295375b953945fb1624f0 Fix mex compilation with subdirs on Windows platforms (bug #37122) * mkoctfile.in.cc (basename): Fix basename routine which was returning basedir, not basename. diff -r 704ab1b4c369 -r 8bd5c490b787 src/mkoctfile.in.cc --- a/src/mkoctfile.in.cc Tue Sep 04 21:56:12 2012 -0700 +++ b/src/mkoctfile.in.cc Wed Sep 05 08:14:37 2012 -0700 @@ -25,6 +25,7 @@ #endif #include +#include #include #include #include @@ -319,7 +320,7 @@ " F77_INTEGER_8_FLAG SED\n" " FFLAGS XTRA_CFLAGS\n" " FFTW3_LDFLAGS XTRA_CXXFLAGS\n" -" FFTW3_LIBS +" FFTW3_LIBS\n" " FFTW3F_LDFLAGS\n" " FFTW3F_LIBS\n" "\n" @@ -352,21 +353,23 @@ static string basename (const string& s, bool strip_path = false) { + string retval; size_t pos = s.rfind ('.'); - string retval; if (pos == string::npos) retval = s; else retval = s.substr (0, pos); + if (strip_path) { size_t p1 = retval.rfind ('/'), p2 = retval.rfind ('\\'); pos = (p1 != string::npos && p2 != string::npos ? max (p1, p2) : (p2 != string::npos ? p2 : p1)); if (pos != string::npos) - retval = retval.substr (0, pos); + retval = retval.substr (++pos, string::npos); } + return retval; }