Git Product home page Git Product logo

filesystem-proposal's People

Contributors

beman avatar jyasskin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

filesystem-proposal's Issues

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

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.

error_code per operation complex the interface too much

That does not feel good. But a 'traditional' global error code makes thread-safe coding hard.

My suggestions are:

  1. Add an error_code member to directory_entry, *directory_iterator, and provide a member function like is_valid() for user to check the status;
  2. Move the non-member operational functions into a context class, so that the error code can be managed in the same way.

Range support for directory_iterator and recursive_directory_iterator

Description

Daniel Krügler [c++std-filesystem-29]

IMO the range-support for [recursive_]directory_iterator should be deferred.
The presented technique is IMO an unfortunate "hack" and should be
replaced by factory functions returning a
std::range<[recursive_]directory_iterator>.

The std::range is IMO the much better solution for this and idiomatic.

Yes, we have not yet std::range, but we nearly got that via a last-minute
proposal for C++11. I hope, this time we have a bit more time to make
a full-fledged
proposal.

I would strongly recommend to defer the range-support instead. We can work with
these iterators, they are not broken, several existing iterators
provide no direct
support for the range-for-loop. It is not a shame that
[recursive_]directory_iterator
would not at the initial proposal.

Adding a "cleaner" way via factory functions returning a
std::range<[recursive_]directory_iterator>
can be easily down slightly later.

Discussion

[Beman] I believe the Filesystem library should become a Technical Specification, and as such should rely only on C++11 features.

Deciding if the target is a TS or is C++1y needs to be deferred to a committee meeting so that input from the LWG (and possibly the EWG) is available. Thus an issue is being opened so Daniel's proposal isn't forgotten.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.