src/library/base/FileUtils.cpp
@@ -42,4 +42,23 @@ throw(errno); } string remove_extension(const string& path) { if (path == "." || path == "..") { return path; } size_t dotpos = path.find_last_of("."); //no dot if (dotpos == string::npos) { return path; } //find the last path separator size_t pathsep_pos = path.find_last_of("\\/"); if (pathsep_pos == string::npos) { return (dotpos == 0 ? path : path.substr(0, dotpos)); } else if(pathsep_pos >= dotpos +1) { return path; } return path.substr(0, dotpos); } }