Mercurial > hg > octave-lyh
changeset 15299:8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
* mkoctfile.in.cc (basename): Fix basename routine which was returning basedir,
not basename.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 05 Sep 2012 08:14:37 -0700 |
parents | 704ab1b4c369 |
children | fd27e10b9b05 |
files | src/mkoctfile.in.cc |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mkoctfile.in.cc +++ b/src/mkoctfile.in.cc @@ -25,6 +25,7 @@ #endif #include <string> +#include <cstring> #include <map> #include <list> #include <algorithm> @@ -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; }