blob: bee392d0d9fb86731b27ec39e3c1430272addb93 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/ibrcommon/data/File.cpp
2+++ b/ibrcommon/data/File.cpp
3@@ -35,10 +35,6 @@
4 #include <cerrno>
5 #include <fstream>
6
7-#if !defined(HAVE_FEATURES_H) || defined(ANDROID)
8-#include <libgen.h>
9-#endif
10-
11 #ifdef __WIN32__
12 #include <io.h>
13 #define FILE_DELIMITER_CHAR '\\'
14@@ -225,14 +221,11 @@ namespace ibrcommon
15
16 std::string File::getBasename() const
17 {
18-#if !defined(ANDROID) && defined(HAVE_FEATURES_H)
19- return std::string(basename(_path.c_str()));
20-#else
21- char path[_path.length()+1];
22- ::memcpy(&path, _path.c_str(), _path.length()+1);
23-
24- return std::string(basename(path));
25-#endif
26+ size_t found = _path.find_last_of('/');
27+ if (found != std::string::npos)
28+ return _path.substr(found + 1);
29+ else
30+ return _path;
31 }
32
33 File File::get(const std::string &filename) const