Commit Graph

802 Commits

Author SHA1 Message Date
Jeroen van Rijn
d7a83a7a1f Revert "os2: Don't try to translate Windows file attributes to Unix mode flags"
This reverts commit 95923c2059.
It'll be updated later.
2025-05-12 23:34:12 +02:00
Jeroen van Rijn
30388cada3 Fix os2.clean_path on Windows 2025-05-11 15:35:52 +02:00
Laytan Laats
cacb9f9f54 os2: better copy_directory, and add native copy_file and copy_directory variants on MacOS 2025-05-08 19:32:30 +02:00
Lucas Perlind
f5b947ea73 Fix linux 2025-05-08 17:45:29 +10:00
Lucas Perlind
14c5096b81 Improve assert information 2025-05-08 17:41:03 +10:00
Lucas Perlind
9f2d008a8a Remove TEMP_ALLOCATOR_GUARD wrapper 2025-05-08 17:41:03 +10:00
Lucas Perlind
5292a7f4f3 Fix posix 2025-05-08 17:41:03 +10:00
Lucas Perlind
1bea59ee68 Fix linux 2025-05-08 17:41:03 +10:00
Lucas Perlind
190960e103 fix -vet 2025-05-08 17:41:03 +10:00
Lucas Perlind
b9db1dd3e0 os2: Resolve temp allocator collisions 2025-05-08 17:41:01 +10:00
Laytan
7c1a9f1e7a Merge pull request #5127 from laytan/fix-process-windows-handles-handling
Fix process windows handles handling
2025-05-06 22:31:54 +02:00
laytan
9b218a2922 don't need to hang on to the null handle 2025-05-06 19:42:52 +02:00
Laytan
bf5206968a close null_handle 2025-05-06 20:57:26 +02:00
Laytan
2bce446d08 ifs wrong way around 2025-05-06 20:47:51 +02:00
Laytan
814a500e83 Windows was defaulting to the std handles of the current process, which is wrong 2025-05-06 20:43:02 +02:00
Brian
27edbc5a76 Fix: Correct value cloning in os2._set_env for POSIX
The _set_env procedure in core/os/os2/env_posix.odin was
incorrectly cloning the 'key' argument for 'cval' instead of
the 'value' argument. This resulted in set_env effectively
setting the environment variable's value to its own key.

This commit corrects the typo to use the 'value' argument.
2025-05-06 17:45:06 +08:00
Jeroen van Rijn
32cef4c11b Fix change_times on Windows and simplify time handling in stat 2025-05-04 22:55:27 +02:00
Jeroen van Rijn
95923c2059 os2: Don't try to translate Windows file attributes to Unix mode flags
Also, fix `chmod`. It passed the wrong struct size to `SetFileInformationByHandle`.
2025-05-04 20:03:07 +02:00
Jeroen van Rijn
0f2a4b80ef Proper fix for executable name on Linux. 2025-05-04 01:05:10 +02:00
Jeroen van Rijn
deededfb0a Fix executable_path info on Linux 2025-05-04 00:21:20 +02:00
Rohan Jadav
f50698b901 updated file_windows.odin to follow coding conventions 2025-05-01 00:56:31 +05:30
Jamie Dennis
ff0eac2a71 os2: Use win32_wstring_to_utf8 over win32_utf16_to_utf8 when converting FIND_DATAW to File_Info 2025-04-30 21:38:17 +12:00
Rohan Jadav
80a6f8928a fix: Pipe size on windows. 2025-04-27 01:58:37 +05:30
gingerBill
f3cc734b39 Add copy_directory 2025-04-25 09:01:53 +01:00
Laytan Laats
74a66f7794 os2: fix get_executable_path() on FreeBSD including the nil-terminator 2025-04-12 21:33:44 +02:00
Jeroen van Rijn
c13b68f103 Fix os2/process defer error. 2025-04-07 13:33:21 +02:00
Dave Voutila
18988b5f94 Fix use of errno on OpenBSD. 2025-03-27 10:36:40 -04:00
Jeroen van Rijn
660598ca8a Fix #4968 2025-03-25 12:01:02 +01:00
gingerBill
2b8c76354d Use copy over intrinsics.mem_copy_non_overlapping 2025-03-24 11:31:05 +00:00
Feoramund
649376fcfe Add require_results to getters in os2 path API 2025-03-21 19:14:15 -04:00
Feoramund
cfa3e97968 Make os2 Linux _is_path_separator compare against _Path_Separator 2025-03-21 19:14:15 -04:00
Feoramund
6a6980fda8 Remove if ODIN_OS == .Windows in file that can only be built on Windows 2025-03-21 19:14:15 -04:00
Feoramund
4e7f54c565 Decouple usage of filepath from os2 2025-03-21 19:14:15 -04:00
Feoramund
abe0c30837 Add new path API for os2 2025-03-21 19:14:15 -04:00
Feoramund
d1d86234aa Add missing documentation to os2/path 2025-03-20 18:36:26 -04:00
Feoramund
a495cd581c Assert that _Path_Separator is 7-bit ASCII
There are several places where this is assumed to be true, most visibly
in `is_path_separator`, as it takes a `byte` argument.

Note that the data type of `_Path_Separator` is a rune, which allows any
Unicode value.
2025-03-20 14:43:54 -04:00
Feoramund
2ab1ca29e6 Fix data races in os2/env_linux.odin
Switched to a recursive mutex so that procedures which need to perform
lookups can do so while also maintaining the lock across their entire
body in order to guarantee atomicity for each environment operation.
2025-03-04 19:32:05 -05:00
Feoramund
179e5b9266 Fix typo 2025-03-04 19:12:45 -05:00
Feoramund
266f15b672 Fix indentation 2025-03-04 19:11:32 -05:00
Feoramund
2d0dc44636 Shorten buffers used for os2.random_string results
This is needed now that `os2.random_string` fills the whole slice.
2025-03-03 19:18:54 -05:00
Feoramund
d6002d68a2 Make os2.random_string use context.random_generator
This removes the data race caused by multiple threads using the
unprotected global `random_string_seed`, so long as no two threads share
the same random generator; this is the default case.

Additionally, `os2.random_string` now takes into account the full buffer
slice given to it.
2025-03-03 19:17:29 -05:00
Feoramund
675bffce88 Add missing allocator in os2.file_info_clone 2025-03-02 17:22:43 -05:00
Feoramund
7d1fcfa09b Fix wrong path in os2.user_config_dir 2025-03-02 17:22:40 -05:00
gingerBill
bb429696f8 Merge pull request #4877 from laytan/os2-additions
os/os2: recursive directory walker, expose errors in read_directory, file clone
2025-02-28 14:37:47 +00:00
gingerBill
8a8894a981 Merge pull request #4891 from Feoramund/fix-4890
Fix #4890
2025-02-28 14:08:27 +00:00
gingerBill
79944056b9 Add Error to os2.set_env 2025-02-28 13:52:51 +00:00
gingerBill
b3bbb00f1a Add Error as part of the return values of os2.environ 2025-02-28 13:43:50 +00:00
Feoramund
b2e3b34ce0 Fix #4890
`strings.to_cstring` previously would not check if the buffer could
handle the extra null byte and could lead to segmentation violations
when using the resulting string in an API expecting the terminator.
2025-02-27 18:54:38 -05:00
Laytan Laats
0e4140a602 os/os2: recursive directory walker, expose errors in read_directory, file clone
Adds a directory walker, a method of exposing and retrieving errors from
the existing read directory iterator, allows reusing of the existing
read directory iterator, and adds a file clone procedure
2025-02-24 20:40:44 +01:00
Samuel Elgozi
61f02d9f49 pass flags down from os.send in darwin and linux 2025-01-26 14:03:45 +02:00