X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Futils.h;h=2b2f23cba6cc2168ccd0c61a4a4bfe92f58bf60a;hb=e48e54c5690d086c3f3ffb6f34f424f253bfb6b1;hp=ed0bdcc3217dc1821d065a0483426ff283ad96e2;hpb=9a8993b390544fb3e6b23ed562e2a2d4a62e4a7c;p=libs%2Fcore.git diff --git a/source/utils.h b/source/utils.h index ed0bdcc..2b2f23c 100644 --- a/source/utils.h +++ b/source/utils.h @@ -1,3 +1,8 @@ +/* +This file is part of libmsppath +Copyright © 2006 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ #ifndef MSP_PATH_UTILS_H_ #define MSP_PATH_UTILS_H_ @@ -23,6 +28,8 @@ extern std::list list_files(const Path &); extern bool exists(const Path &); extern Filename splitext(const std::string &); extern int fnmatch(const std::string &, const Path &); +extern Path relative(const Path &, const Path &); +extern std::string basename(const std::string &); inline int stat(const Path &fn, struct stat &st) { return ::stat(fn.str().c_str(), &st); } @@ -30,6 +37,9 @@ inline int stat(const Path &fn, struct stat &st) inline Path getcwd() { char buf[1024]; return ::getcwd(buf, sizeof(buf)); } +inline bool is_windows_drive(const std::string &p) +{ return (p.size()==2 && ((p[0]>='A' && p[0]<='Z') || (p[0]>='a' && p[0]<='z')) && p[1]==':'); } + } // namespace Path } // namespace Msp