#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/path.h"
#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
{
defName = ftp2defnm(fnm->ftp);
}
- else if (std::strchr(defName, '.') != NULL)
+ else if (Path::hasExtension(defName))
{
defType = fn2ftp(defName);
GMX_RELEASE_ASSERT(defType != efNR,
return path.substr(pos+1);
}
+bool Path::hasExtension(const std::string &path)
+{
+ return getFilename(path).find('.') != std::string::npos;
+}
+
std::string Path::stripExtension(const std::string &path)
{
size_t dirSeparatorPos = path.find_last_of(cDirSeparators);
static std::string normalize(const std::string &path);
static std::string getParentPath(const std::string &path);
static std::string getFilename(const std::string &path);
+ static bool hasExtension(const std::string &path);
static std::string stripExtension(const std::string &path);
static bool exists(const char *path);