crt.odin 414 B

123456789101112131415
  1. // +build windows
  2. package win32
  3. import "core:strings"
  4. foreign {
  5. @(link_name="_wgetcwd") _get_cwd_wide :: proc(buffer: Wstring, buf_len: int) -> ^Wstring ---
  6. }
  7. get_cwd :: proc(allocator := context.temp_allocator) -> string {
  8. buffer := make([]u16, MAX_PATH_WIDE, allocator)
  9. _get_cwd_wide(Wstring(&buffer[0]), MAX_PATH_WIDE)
  10. file := utf16_to_utf8(buffer[:], allocator)
  11. return strings.trim_right_null(file)
  12. }