7 Commits

Author SHA1 Message Date
gingerBill
51536fecf4 Move some of the os&os2 errors into io.Error; Rename Empty to Unsupported 2025-11-14 11:08:24 +00:00
Jeroen van Rijn
1a2f83f123 Add bring-your-own-buffer versions of os.lookup_env and os.get_env
And make `core:terminal` use it so that `core:log` can be imported with `-default-to-nil-allocator`,
in which the actual allocator is set up in `main()`.

Windows was tricky because of the utf-8 <> utf-16 conversion, so we use some temporary stack buffers for that purpose,
limiting the non-allocating version there to 512 utf-16 characters each for the key and environment value.

In general the value is (obviously) limited to the size of the supplied buffer, and a `.Buffer_Full` error is returned
if that buffer is insufficient. If the key is not found, the procedure returns `.Env_Var_Not_Found`.

TODO:
- Factor out buffer-backed utf8 + utf16 conversion to `core:sys/util` to more easily apply this pattern.
- Add similar `lookup_env` and `get_env` procedures to `core:os/os2`.

Fixes #5336
2025-06-16 20:12:26 +02:00
gingerBill
c078b2dd1b Add @(require_results) 2024-08-04 15:24:26 +01:00
gingerBill
e8d26c5797 Move errors to where appropriate 2024-08-04 13:41:34 +01:00
gingerBill
3d992e2704 Improve _error_string for Linux 2024-08-04 13:25:35 +01:00
gingerBill
7663a2036a Add read_at/write_at to missing platforms 2024-08-04 13:16:37 +01:00
gingerBill
c32f345c68 Move error stuff to errors.odin 2024-08-04 12:55:08 +01:00