X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Futils.cpp;h=31ab53be7b2ed210cf66dd9f2996972f0d33b25f;hb=911ae41312cf1c9db02b8b513cc8edbe78d97006;hp=45cd614b150ccaaea463f3c9860dabbe3bc82e1d;hpb=92eb9e8756f0eb85bbefac59cc8cfbfc914b70f7;p=libs%2Fcore.git diff --git a/source/utils.cpp b/source/utils.cpp index 45cd614..31ab53b 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -8,8 +8,10 @@ Distributed under the LGPL #include #ifndef WIN32 #include +#else +#include #endif -#include +#include #include "path.h" #include "utils.h" @@ -89,6 +91,7 @@ int mkpath(const Path &path, int mode) { #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); @@ -133,7 +136,8 @@ list list_files(const Path &path) 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); @@ -144,14 +148,14 @@ list list_files(const Path &path) 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; @@ -160,7 +164,7 @@ Filename splitext(const string &fn) int fnmatch(const string &pat, const Path &fn) { #ifdef WIN32 - return -1; + return globcasematch(pat, fn.str()); #else return ::fnmatch(pat.c_str(), fn.str().c_str(), FNM_PATHNAME); #endif