From 1a8a34d15089ad6cb3f11dd14ead0f4797a8270e Mon Sep 17 00:00:00 2001 From: Steven Lee Date: Thu, 30 Jul 2015 12:54:07 +0800 Subject: [PATCH] fix windows path issue use basename to let get_filename support both Windows and Linux path --- src/util/path.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/path.cc b/src/util/path.cc index 5abc7a590..0bf16609f 100644 --- a/src/util/path.cc +++ b/src/util/path.cc @@ -9,7 +9,7 @@ #include #include #include - +#include #include "path.h" #ifdef __MINGW32__ @@ -114,12 +114,18 @@ bool is_truetype_suffix(const string & suffix) string get_filename (const string & path) { + char* s= basename(strdup(path.c_str())); + std::string str(s); + return str; + + /* size_t idx = path.rfind('/'); if(idx == string::npos) return path; else if (idx == path.size() - 1) return ""; return path.substr(idx + 1); + */ } string get_suffix(const string & path)