]> git.tdb.fi Git - libs/core.git/blob - source/fs/unix/dir.cpp
Have get_user_data_dir return a proper location on Android
[libs/core.git] / source / fs / unix / dir.cpp
1 #include <unistd.h>
2 #include <sys/stat.h>
3 #include <msp/core/systemerror.h>
4 #include "dir.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace FS {
10
11 void mkdir(const Path &path, int mode)
12 {
13         if(::mkdir(path.str().c_str(), mode)==-1)
14                 throw system_error("mkdir");
15 }
16
17 void rmdir(const Path &path)
18 {
19         if(::rmdir(path.str().c_str())==-1)
20                 throw system_error("rmdir");
21 }
22
23 Path getcwd()
24 {
25         char buf[1024];
26         return ::getcwd(buf, sizeof(buf));
27 }
28
29 void chdir(const Path &path)
30 {
31         if(::chdir(path.str().c_str())==-1)
32                 throw system_error("chdir");
33 }
34
35 } // namespace FS
36 } // namespace Msp