unsigned size() const;
bool empty() const { return path.empty(); }
bool is_absolute() const;
- Path subpath(unsigned, unsigned =(unsigned)-1) const;
+ Path subpath(unsigned, unsigned =static_cast<unsigned>(-1)) const;
Path operator/(const Path &p) const { Path a=*this; a/=p; return a; }
Path &operator/=(const Path &);
std::string operator[](int) const;
#include <errno.h>
#ifndef WIN32
#include <fnmatch.h>
+#else
+#include <msp/strings/glob.h>
#endif
#include <msp/strings/utils.h>
#include "path.h"
{
#ifdef WIN32
// The win32 version of this function doesn't take the mode argument. Go figure.
+ (void)mode;
err=mkdir(p.str().c_str());
#else
err=mkdir(p.str().c_str(),mode);
while(dirent *de=readdir(dir))
{
const char *fn=de->d_name;
- if(fn[0]=='.' && (fn[1]==0 || (fn[1]=='.' && fn[2]==0))) continue;
+ if(fn[0]=='.' && (fn[1]==0 || (fn[1]=='.' && fn[2]==0)))
+ continue;
result.push_back(fn);
}
closedir(dir);
bool exists(const Path &path)
{
struct stat st;
- return !stat(path.str().c_str(),&st);
+ return !stat(path.str().c_str(), &st);
}
Filename splitext(const string &fn)
{
Filename result;
unsigned dot=fn.rfind('.');
- result.base=fn.substr(0,dot);
+ result.base=fn.substr(0, dot);
if(dot!=string::npos)
result.ext=fn.substr(dot);
return result;
int fnmatch(const string &pat, const Path &fn)
{
#ifdef WIN32
- return -1;
+ return globcasematch(pat, fn);
#else
return ::fnmatch(pat.c_str(), fn.str().c_str(), FNM_PATHNAME);
#endif