Skip to content

Commit fd61719

Browse files
committed
---
yaml --- r: 14612 b: refs/heads/try c: 6b0c482 h: refs/heads/master v: v3
1 parent e942fa6 commit fd61719

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 3cb2cd1f7133619761a7c229185f0ab227526181
5+
refs/heads/try: 6b0c4822c10d1e0824043f81fc9e39096cc40172
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libstd/freebsd_os.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ native mod libc {
6262
fn mkdir(path: str::sbuf, mode: c_int) -> c_int;
6363
fn rmdir(path: str::sbuf) -> c_int;
6464
fn chdir(path: str::sbuf) -> c_int;
65+
fn unlink(path: str::sbuf) -> c_int;
6566

6667
fn sysctl(name: *c_int, namelen: c_uint,
6768
oldp: *u8, &oldlenp: size_t,

branches/try/src/libstd/fs.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,27 @@ fn homedir() -> option<path> {
449449
}
450450
}
451451

452+
/*
453+
Function: remove_file
454+
455+
Deletes an existing file.
456+
*/
457+
fn remove_file(p: path) -> bool {
458+
ret unlink(p);
459+
460+
#[cfg(target_os = "win32")]
461+
fn unlink(p: path) -> bool {
462+
ret str::as_buf(p, {|buf| os::kernel32::DeleteFileA(buf)});
463+
}
464+
465+
#[cfg(target_os = "linux")]
466+
#[cfg(target_os = "macos")]
467+
#[cfg(target_os = "freebsd")]
468+
fn unlink(_p: path) -> bool {
469+
ret str::as_buf(_p, {|buf| os::libc::unlink(buf) == 0i32 });
470+
}
471+
}
472+
452473
#[cfg(test)]
453474
mod tests {
454475
#[test]

branches/try/src/libstd/linux_os.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ native mod libc {
6363
fn mkdir(path: str::sbuf, mode: c_int) -> c_int;
6464
fn rmdir(path: str::sbuf) -> c_int;
6565
fn chdir(path: str::sbuf) -> c_int;
66+
fn unlink(path: str::sbuf) -> c_int;
6667
}
6768

6869
mod libc_constants {

branches/try/src/libstd/macos_os.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ native mod libc {
5555
fn mkdir(s: str::sbuf, mode: c_int) -> c_int;
5656
fn rmdir(s: str::sbuf) -> c_int;
5757
fn chdir(s: str::sbuf) -> c_int;
58+
fn unlink(path: str::sbuf) -> c_int;
5859

5960
// FIXME: Needs varags
6061
fn fcntl(fd: fd_t, cmd: c_int) -> c_int;

branches/try/src/libstd/win32_os.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ native mod kernel32 {
6262
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> bool;
6363
fn RemoveDirectoryA(lpPathName: LPCTSTR) -> bool;
6464
fn SetCurrentDirectoryA(lpPathName: LPCTSTR) -> bool;
65+
fn DeleteFileA(lpFileName: LPCTSTR) -> bool;
6566
}
6667

6768
// FIXME turn into constants

0 commit comments

Comments
 (0)