About std::filesystem::is_regular_file(path)
, cppreference.com says:
Checks if the given file status or path corresponds to a regular file […] Equivalent to
s.type() == file_type::regular
.
For example, in the Linux kernel, file types are declared in the header file sys/stat.h
. The type name and symbolic name for each Linux file type is listed below:
What is the thing that this function checks on Windows?
Since we are talking about Windows we can consider MS implementation of the standard library, and that's how they determine if the file is regular:
if (_Bitmask_includes(_Attrs, __std_fs_file_attr::_Reparse_point)) {
if (_Stats._Reparse_point_tag == __std_fs_reparse_tag::_Symlink) {
this->type(file_type::symlink);
return;
}
if (_Stats._Reparse_point_tag == __std_fs_reparse_tag::_Mount_point) {
this->type(file_type::junction);
return;
}
// All other reparse points considered ordinary files or directories
}
if (_Bitmask_includes(_Attrs, __std_fs_file_attr::_Directory)) {
this->type(file_type::directory);
} else {
this->type(file_type::regular);
}
So if it isn't IO_REPARSE_TAG_MOUNT_POINT
, IO_REPARSE_TAG_SYMLINK
or a directory, then it is a regular file.