1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: fix v symlink on windows

This commit is contained in:
Delyan Angelov 2021-04-05 16:06:03 +03:00
parent 90b123c27b
commit 92f40f9642
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -147,8 +147,8 @@ fn get_reg_sys_env_handle() ?voidptr {
fn get_reg_value(reg_env_key voidptr, key string) ?string { fn get_reg_value(reg_env_key voidptr, key string) ?string {
$if windows { $if windows {
// query the value (shortcut the sizing step) // query the value (shortcut the sizing step)
reg_value_size := 4095 // this is the max length (not for the registry, but for the system %PATH%) reg_value_size := u32(4095) // this is the max length (not for the registry, but for the system %PATH%)
mut reg_value := unsafe { &u16(malloc(reg_value_size)) } mut reg_value := unsafe { &u16(malloc(int(reg_value_size))) }
if C.RegQueryValueExW(reg_env_key, key.to_wide(), 0, 0, reg_value, &reg_value_size) != 0 { if C.RegQueryValueExW(reg_env_key, key.to_wide(), 0, 0, reg_value, &reg_value_size) != 0 {
return error('Unable to get registry value for "$key".') return error('Unable to get registry value for "$key".')
} }
@ -173,7 +173,7 @@ fn set_reg_value(reg_key voidptr, key string, value string) ?bool {
// letting them know that the system environment has changed and should be reloaded // letting them know that the system environment has changed and should be reloaded
fn send_setting_change_msg(message_data string) ?bool { fn send_setting_change_msg(message_data string) ?bool {
$if windows { $if windows {
if C.SendMessageTimeoutW(os.hwnd_broadcast, os.wm_settingchange, 0, message_data.to_wide(), if C.SendMessageTimeoutW(os.hwnd_broadcast, os.wm_settingchange, 0, unsafe { &u32(message_data.to_wide()) },
os.smto_abortifhung, 5000, 0) == 0 { os.smto_abortifhung, 5000, 0) == 0 {
return error('Could not broadcast WM_SETTINGCHANGE') return error('Could not broadcast WM_SETTINGCHANGE')
} }