Skip to content

Commit d0a2f00

Browse files
committed
stdlib: win32 fixes for dir handling
1 parent 9dd4789 commit d0a2f00

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/lib/fs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ fn make_dir(p: path, mode: int) -> bool {
125125
ret mkdir(p, mode);
126126

127127
#[cfg(target_os = "win32")]
128-
fn mkdir(_p: path, _mode: int) -> bool {
128+
fn mkdir(_p: path, _mode: int) -> bool unsafe {
129129
// FIXME: turn mode into something useful?
130130
ret str::as_buf(_p, {|buf|
131-
os::kernel32::CreateDirectory(buf, ptr::null())
131+
os::kernel32::CreateDirectoryA(
132+
buf, unsafe::reinterpret_cast(0))
132133
});
133134
}
134135

@@ -167,7 +168,7 @@ fn remove_dir(p: path) -> bool {
167168

168169
#[cfg(target_os = "win32")]
169170
fn rmdir(_p: path) -> bool {
170-
ret str::as_buf(_p, {|buf| os::kernel32::RemoveDirectory(buf)});
171+
ret str::as_buf(_p, {|buf| os::kernel32::RemoveDirectoryA(buf)});
171172
}
172173

173174
#[cfg(target_os = "linux")]

src/lib/win32_os.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ native mod kernel32 {
5252
fn GetModuleFileNameA(hModule: HMODULE,
5353
lpFilename: LPTSTR,
5454
nSize: DWORD) -> DWORD;
55-
fn CreateDirectory(lpPathName: LPCTSTR,
56-
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> bool;
57-
fn RemoveDirectory(lpPathName: LPCTSTR) -> bool;
55+
fn CreateDirectoryA(lpPathName: LPCTSTR,
56+
lpSecurityAttributes: LPSECURITY_ATTRIBUTES) -> bool;
57+
fn RemoveDirectoryA(lpPathName: LPCTSTR) -> bool;
5858
}
5959

6060
// FIXME turn into constants

0 commit comments

Comments
 (0)