Uh oh!
There was an error while loading. Please reload this page.
glob.h bindings - #5832
Conversation
erickt
commented
Apr 11, 2013
I'm not sure if this should be in the standard library, but instead in a third party crate. What does everyone else think? |
bstrie
commented
Apr 12, 2013
@erickt I don't know about systems languages, but globbing facilities are certainly present in the standard libraries of scripting languages. I'm ever-so-slightly concerned that, in the absence of this, people will resort to shelling-out to |
graydon
commented
Apr 12, 2013
I think it's fine to adopt something like this. I'm uncomfortable about this as-presented for the following reasons:
|
doy
commented
Apr 13, 2013
|
graydon
commented
Apr 13, 2013
Ok. Can you move the code to the |
doy
commented
Apr 13, 2013
Updated. I'll file a bug for the todo items once it gets merged. |
graydon
commented
Apr 15, 2013
sadly now this needs a rebase :( |
only tested on linux/x86_64, but i got the values for other platforms from their system header files. no bindings for win32, because win32 doesn't include glob.h. also, glob() takes a callback for error handling, but i'm just making this a *c_void for now, since i don't know how to represent c calling back into rust (if that's even currently possible).
this could probably use expansion - it just uses all of the default options, which is usually what we want, but not always. maybe add a separate function that takes more options?
doy
commented
Apr 29, 2013
Okay, this is updated. I'm seeing a failure in the test suite in src/test/run-pass/too-much-recursion.rs: "rust: task 7f00c02041b0 ran out of stack", but I don't think it's related to my changes. |
doy
commented
May 1, 2013
Oops, forgot to add |
…earth Update Usage section of README.md Fixesrust-lang#5826 changelog: none
5832: Update crates r=kjeremy a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>
This adds low level bindings for
glob()andglobfree()inlibc, and adds a staticglob()function toPathwhich uses those. It has only been tested on Linux/x86_64, but I looked up header file definitions for other platforms, so they should hopefully work in theory. Windows doesn't have these functions, so that is currently unimplemented, although ideallyPath::glob()could be reimplemented in terms of Windows primitives instead, at some point in the future.I'm not sure what a good way to test this would be - it requires looking at the actual filesystem, so I'm not sure where a safe place to do that would be. I'd be willing to add some if people have recommendations.