stdlib: win32 fixes for dir handling

This commit is contained in:
Brian Anderson 2011-11-22 15:14:34 -08:00
parent 9dd4789d80
commit d0a2f00611
2 changed files with 7 additions and 6 deletions

View File

@ -125,10 +125,11 @@ fn make_dir(p: path, mode: int) -> bool {
ret mkdir(p, mode);
#[cfg(target_os = "win32")]
fn mkdir(_p: path, _mode: int) -> bool {
fn mkdir(_p: path, _mode: int) -> bool unsafe {
// FIXME: turn mode into something useful?
ret str::as_buf(_p, {|buf|
os::kernel32::CreateDirectory(buf, ptr::null())
os::kernel32::CreateDirectoryA(
buf, unsafe::reinterpret_cast(0))
});
}
@ -167,7 +168,7 @@ fn remove_dir(p: path) -> bool {
#[cfg(target_os = "win32")]
fn rmdir(_p: path) -> bool {
ret str::as_buf(_p, {|buf| os::kernel32::RemoveDirectory(buf)});
ret str::as_buf(_p, {|buf| os::kernel32::RemoveDirectoryA(buf)});
}
#[cfg(target_os = "linux")]

View File

@ -52,9 +52,9 @@ native mod kernel32 {
fn GetModuleFileNameA(hModule: HMODULE,
lpFilename: LPTSTR,
nSize: DWORD) -> DWORD;
fn CreateDirectory(lpPathName: LPCTSTR,
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> bool;
fn RemoveDirectory(lpPathName: LPCTSTR) -> bool;
fn CreateDirectoryA(lpPathName: LPCTSTR,
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> bool;
fn RemoveDirectoryA(lpPathName: LPCTSTR) -> bool;
}
// FIXME turn into constants