crt.odin 401 B

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