]> git.tdb.fi Git - libs/core.git/blobdiff - source/utils.h
Add relative() to utils
[libs/core.git] / source / utils.h
index ed0bdcc3217dc1821d065a0483426ff283ad96e2..faf5ef7f261e038e2e1d688ec013d150b93369cd 100644 (file)
@@ -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<std::string> 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