Skip to content

not possible to check whether a directory_iterator was created via a symlink #4

@jiixyj

Description

@jiixyj

It would be nice to have a way to make sure a directory_iterator does not open a symlink to a directory; maybe by adding a function to get a directory_entry structure of the root directory, or by adding another constructor. Currently it is possible to do this:

fs::path root("root");
fs::recursive_directory_iterator iter;
if (!fs::is_symlink(root)) {
     iter = fs::recursive_directory_iterator(root, fs::symlink_option::no_recurse);
}

However, there is a race condition here: After having checked that root is not a symlink, the world may change and the constructor may open a symlink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions