X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.cpp;h=6c48d62a5eecfbafe855cf70b07fb4f2cf553f0b;hp=5c7d6a230803bcaf47c08b9e43b21aaeb2e55ae6;hb=05ea50ffd15fa74ab1059df2c63442fdf83dec96;hpb=174debf33b2001b3244c007825d0a5539566bd8c diff --git a/source/utils.cpp b/source/utils.cpp index 5c7d6a2..6c48d62 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -8,6 +8,8 @@ Distributed under the LGPL #include #ifndef WIN32 #include +#else +#include #endif #include #include "path.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); #else return ::fnmatch(pat.c_str(), fn.str().c_str(), FNM_PATHNAME); #endif