os_win.v: switch => match
parent
a075ce160e
commit
7ba5248e56
|
@ -126,13 +126,15 @@ pub fn get_module_filename(handle HANDLE) ?string {
|
||||||
mut buf := &u16(malloc(4096))
|
mut buf := &u16(malloc(4096))
|
||||||
for {
|
for {
|
||||||
status := C.GetModuleFileName(handle, &buf, sz)
|
status := C.GetModuleFileName(handle, &buf, sz)
|
||||||
switch status {
|
match status {
|
||||||
case SUCCESS:
|
SUCCESS {
|
||||||
_filename := string_from_wide2(buf, sz)
|
_filename := string_from_wide2(buf, sz)
|
||||||
return _filename
|
return _filename
|
||||||
default:
|
}
|
||||||
// Must handled with GetLastError and converted by FormatMessage
|
else {
|
||||||
return error('Cannot get file name from handle')
|
// Must handled with GetLastError and converted by FormatMessage
|
||||||
|
return error('Cannot get file name from handle')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic('this should be unreachable') // TODO remove unreachable after loop
|
panic('this should be unreachable') // TODO remove unreachable after loop
|
||||||
|
|
Loading…
Reference in New Issue