| 860 | } |
| 861 | |
| 862 | std::string get_basedir() const { |
| 863 | const char * model_path = fname.c_str(); |
| 864 | #if defined(_WIN32) |
| 865 | size_t found = fname.find_last_of("/\\"); |
| 866 | return fname.substr(0, found); |
| 867 | #else |
| 868 | #include <libgen.h> |
| 869 | const char * base_dir = dirname(const_cast<char *>(model_path)); |
| 870 | return std::string(base_dir); |
| 871 | #endif |
| 872 | } |
| 873 | |
| 874 | size_t tell() const { |
| 875 | #ifdef _WIN32 |