X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.h;h=faf5ef7f261e038e2e1d688ec013d150b93369cd;hp=ed0bdcc3217dc1821d065a0483426ff283ad96e2;hb=bfbb7edfb2ae76d23f26e0b22787617ff621747d;hpb=9a8993b390544fb3e6b23ed562e2a2d4a62e4a7c diff --git a/source/utils.h b/source/utils.h index ed0bdcc..faf5ef7 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,7 @@ 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 &); inline int stat(const Path &fn, struct stat &st) { return ::stat(fn.str().c_str(), &st); } @@ -30,6 +36,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