2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
2011-11-16 22:49:38 -06:00
|
|
|
#[abi = "cdecl"]
|
|
|
|
native mod rustrt {
|
2011-10-20 10:18:39 -07:00
|
|
|
fn rust_list_files(path: str) -> [str];
|
2011-03-10 15:56:51 +01:00
|
|
|
}
|
|
|
|
|
2011-09-12 11:27:30 +02:00
|
|
|
fn list_dir(path: str) -> [str] {
|
2011-09-02 15:34:58 -07:00
|
|
|
let path = path + "*";
|
2011-09-01 15:51:27 -07:00
|
|
|
ret rustrt::rust_list_files(path);
|
|
|
|
}
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2011-09-12 11:27:30 +02:00
|
|
|
fn path_is_absolute(p: str) -> bool {
|
2011-09-01 17:27:58 -07:00
|
|
|
ret str::char_at(p, 0u) == '/' ||
|
2011-10-05 12:01:10 -07:00
|
|
|
str::char_at(p, 1u) == ':'
|
|
|
|
&& (str::char_at(p, 2u) == path_sep
|
|
|
|
|| str::char_at(p, 2u) == alt_path_sep);
|
2011-06-17 15:52:37 -07:00
|
|
|
}
|
|
|
|
|
2011-03-20 19:43:12 -07:00
|
|
|
/* FIXME: win32 path handling actually accepts '/' or '\' and has subtly
|
|
|
|
* different semantics for each. Since we build on mingw, we are usually
|
|
|
|
* dealing with /-separated paths. But the whole interface to splitting and
|
|
|
|
* joining pathnames needs a bit more abstraction on win32. Possibly a vec or
|
|
|
|
* tag type.
|
|
|
|
*/
|
2011-07-27 14:19:39 +02:00
|
|
|
const path_sep: char = '/';
|
2011-03-16 14:58:02 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
const alt_path_sep: char = '\\';
|
2011-03-16 14:58:02 -07:00
|
|
|
// Local Variables:
|
|
|
|
// mode: rust;
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
|
|
|
// End:
|