fix for is-file? function
This commit is contained in:
@@ -50,8 +50,13 @@ MlValue list_dir(const std::string &path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_path_file(const std::string &path) {
|
bool is_path_file(const std::string &path) {
|
||||||
std::ifstream ifile(path.c_str());
|
struct stat buf{};
|
||||||
return (bool) ifile;
|
stat(path.c_str(), &buf);
|
||||||
|
return (bool) S_ISREG(buf.st_mode) ||
|
||||||
|
(bool) S_ISBLK(buf.st_mode) ||
|
||||||
|
(bool) S_ISCHR(buf.st_mode) ||
|
||||||
|
(bool) S_ISFIFO(buf.st_mode) ||
|
||||||
|
(bool) S_ISSOCK(buf.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_path_dir(const std::string &path) {
|
bool is_path_dir(const std::string &path) {
|
||||||
|
|||||||
Reference in New Issue
Block a user