windows: "".to_wide() fixes

pull/4195/head
Alexander Medvednikov 2020-04-02 13:24:23 +02:00
parent 1fe2933dd9
commit d9c7253836
2 changed files with 6 additions and 3 deletions

View File

@ -71,7 +71,8 @@ struct WindowsKit {
fn find_windows_kit_root(host_arch string) ?WindowsKit {
$if windows {
root_key := RegKey(0)
rc := C.RegOpenKeyEx(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots'.to_wide(), 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY | KEY_ENUMERATE_SUB_KEYS, &root_key)
path := 'SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots'
rc := C.RegOpenKeyEx(HKEY_LOCAL_MACHINE, path.to_wide(), 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY | KEY_ENUMERATE_SUB_KEYS, &root_key)
defer {
C.RegCloseKey(root_key)
}

View File

@ -131,8 +131,9 @@ pub fn is_dir(path string) bool {
*/
pub fn open(path string) ?File {
mode := 'rb'
file := File {
cfile: C._wfopen(path.to_wide(), 'rb'.to_wide())
cfile: C._wfopen(path.to_wide(), mode.to_wide())
opened: true
}
if isnil(file.cfile) {
@ -143,8 +144,9 @@ pub fn open(path string) ?File {
// create creates a file at a specified location and returns a writable `File` object.
pub fn create(path string) ?File {
mode := 'wb'
file := File {
cfile: C._wfopen(path.to_wide(), 'wb'.to_wide())
cfile: C._wfopen(path.to_wide(), mode.to_wide())
opened: true
}
if isnil(file.cfile) {