some small refactoring

This commit is contained in:
2021-12-19 13:34:29 +01:00
parent 5c925f2608
commit 8ea91f255b
5 changed files with 49 additions and 52 deletions

View File

@@ -55,19 +55,17 @@ bool is_path_file(const std::string &path) {
}
bool is_path_dir(const std::string &path) {
struct stat buf;
struct stat buf{};
stat(path.c_str(), &buf);
return (bool) S_ISDIR(buf.st_mode);
}
int mk_path_dir(const std::string &path) {
int r = ::mkdir(path.c_str(), 0755);
return r;
return ::mkdir(path.c_str(), 0755);
}
int rm_path_dir(const std::string &path) {
int r = ::rmdir(path.c_str());
return r;
return ::rmdir(path.c_str());
}
MlValue exec_system_cmd(const std::string &cmd) {