1 #if !defined(_BTK_PLATFORM_FS_HPP_) 2 #define _BTK_PLATFORM_FS_HPP_ 12 #define BTK_GETCWD ::_getcwd 13 #define BTK_ACCESS ::_access 14 #define BTK_CHDIR ::_chdir 18 #define BTK_GETCWD ::getcwd 19 #define BTK_ACCESS ::access 20 #define BTK_CHDIR ::chdir 23 #include "../exception.hpp" 31 char *buf = BTK_GETCWD(
nullptr,0);
33 throwRuntimeError(strerror(errno));
39 inline std::string
getcwd(
size_t bufsize){
42 if(BTK_GETCWD(s.data(),bufsize) ==
nullptr){
43 throwRuntimeError(strerror(errno));
54 inline bool exists(std::string_view fname){
55 return BTK_ACCESS(fname.data(),BTK_F_OK) == 0;
64 inline bool chdir(std::string_view path){
65 return BTK_CHDIR(path.data()) == 0;
71 #endif // _BTK_PLATFORM_FS_HPP_ This header include many useful containers.
Definition: async.hpp:7
bool chdir(std::string_view path)
Change the current work dir.
Definition: fs.hpp:64
std::string getcwd()
Get current working dir.
Definition: fs.hpp:30
bool exists(std::string_view fname)
Check the file exists.
Definition: fs.hpp:54