]> git.tdb.fi Git - libs/core.git/blob - source/utils.h
Add files
[libs/core.git] / source / utils.h
1 #ifndef MSP_PATH_UTILS_H_
2 #define MSP_PATH_UTILS_H_
3
4 #include <sys/stat.h>
5 #include <unistd.h>
6 #include <list>
7 #include <string>
8 #include "path.h"
9
10 namespace Msp {
11 namespace Path {
12
13 struct Filename
14 {
15         std::string base;
16         std::string ext;
17 };
18
19 extern Path fix_case(const Path &);
20 extern int mkpath(const Path &, int);
21 extern int rmdir(const Path &, bool =false);
22 extern std::list<std::string> list_files(const Path &);
23 extern bool exists(const Path &);
24 extern Filename splitext(const std::string &);
25 extern int fnmatch(const std::string &, const Path &);
26
27 inline int stat(const Path &fn, struct stat &st)
28 { return ::stat(fn.str().c_str(), &st); }
29
30 inline Path getcwd()
31 { char buf[1024]; return ::getcwd(buf, sizeof(buf)); }
32
33 } // namespace Path
34 } // namespace Msp
35
36 #endif