includedir icon indicating copy to clipboard operation
includedir copied to clipboard

Tree API?

Open tilpner opened this issue 9 years ago • 1 comments

I didn't use this with a large amount of files or deep file structures yet, but while a phf map may be fast, it breaks down as soon as the included directories become deeper and more complex.

Would a filesystem-ish tree API be a better fit here? One could imitate the std::fs API without writability, to allow for proper path manipulation, directory listing, tree walking, etc.

Opinions? @emk

tilpner avatar Sep 20 '16 21:09 tilpner

A filesystem-like API would certainly be nice for some use-cases.

My use case is a simple, Rails-style source code template engine for generating new projects and for adding new components to existing projects. The input templates are here.

As you can see, I basically just open templates/new (or templates/_overrides/_default), and then selectively walkdir everything below that point, filtering out anything which begins with an underscore _.

So if you had a filesystem API, I could certainly use it, but it's not absolutely critical in this particular case, because falling back to brute force still has acceptable performance. But for a case like game assets, where there are potentially many more files, then an fs-like API could certainly be useful.

But in any case, the critical operation in my case is walkdir with filtering. Thank you for asking!

emk avatar Sep 21 '16 10:09 emk