diff options
| author | Gareth Smith <garethdanielsmith@gmail.com> | 2013-08-01 23:48:22 +0100 |
|---|---|---|
| committer | Gareth Smith <garethdanielsmith@gmail.com> | 2013-09-05 21:19:47 +0100 |
| commit | 193a1c8af6a0ceef734fff9acc07231c67896bb1 (patch) | |
| tree | cb9247ef6186a9e884c7981e7b06ca00bad07e12 /src/libstd | |
| parent | d84a7b5ae3b3a820fb0a26292632856ceb959b3e (diff) | |
| download | rust-193a1c8af6a0ceef734fff9acc07231c67896bb1.tar.gz rust-193a1c8af6a0ceef734fff9acc07231c67896bb1.zip | |
Replace os::glob with extra::glob, which is written in rust,
fixing issue #6100.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/os.rs | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 0d77748b203..ffd99fc9f75 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1318,90 +1318,6 @@ pub fn args() -> ~[~str] { real_args() } -// FIXME #6100 we should really use an internal implementation of this - using -// the POSIX glob functions isn't portable to windows, probably has slight -// inconsistencies even where it is implemented, and makes extending -// functionality a lot more difficult -// FIXME #6101 also provide a non-allocating version - each_glob or so? -/// Returns a vector of Path objects that match the given glob pattern -#[cfg(target_os = "linux")] -#[cfg(target_os = "android")] -#[cfg(target_os = "freebsd")] -#[cfg(target_os = "macos")] -pub fn glob(pattern: &str) -> ~[Path] { - #[fixed_stack_segment]; #[inline(never)]; - - #[cfg(target_os = "linux")] - #[cfg(target_os = "android")] - fn default_glob_t () -> libc::glob_t { - libc::glob_t { - gl_pathc: 0, - gl_pathv: ptr::null(), - gl_offs: 0, - __unused1: ptr::null(), - __unused2: ptr::null(), - __unused3: ptr::null(), - __unused4: ptr::null(), - __unused5: ptr::null(), - } - } - - #[cfg(target_os = "freebsd")] - fn default_glob_t () -> libc::glob_t { - libc::glob_t { - gl_pathc: 0, - __unused1: 0, - gl_offs: 0, - __unused2: 0, - gl_pathv: ptr::null(), - __unused3: ptr::null(), - __unused4: ptr::null(), - __unused5: ptr::null(), - __unused6: ptr::null(), - __unused7: ptr::null(), - __unused8: ptr::null(), - } - } - - #[cfg(target_os = "macos")] - fn default_glob_t () -> libc::glob_t { - libc::glob_t { - gl_pathc: 0, - __unused1: 0, - gl_offs: 0, - __unused2: 0, - gl_pathv: ptr::null(), - __unused3: ptr::null(), - __unused4: ptr::null(), - __unused5: ptr::null(), - __unused6: ptr::null(), - __unused7: ptr::null(), - __unused8: ptr::null(), - } - } - - let mut g = default_glob_t(); - do pattern.with_c_str |c_pattern| { - unsafe { libc::glob(c_pattern, 0, ptr::null(), &mut g) } - }; - do(|| { - let paths = unsafe { - vec::raw::from_buf_raw(g.gl_pathv, g.gl_pathc as uint) - }; - do paths.map |&c_str| { - Path(unsafe { str::raw::from_c_str(c_str) }) - } - }).finally { - unsafe { libc::globfree(&mut g) }; - } -} - -/// Returns a vector of Path objects that match the given glob pattern -#[cfg(target_os = "win32")] -pub fn glob(_pattern: &str) -> ~[Path] { - fail!("glob() is unimplemented on Windows") -} - #[cfg(target_os = "macos")] extern { // These functions are in crt_externs.h. |
