Commit Graph

8 Commits

Author SHA1 Message Date
Dario Vladović
3e79c0a29d feat: add Platform.homePath foreign method with uv_os_homedir fallback allocation
Implement the `Platform.homePath` static method in the os module, exposing the user's home directory via libuv's `uv_os_homedir`. The implementation handles buffer resizing with dynamic allocation when `UV_ENOBUFS` is returned, aborts the fiber with an error message on failure, and registers the method in the module registry. Includes a test suite verifying the returned value is a non-empty string, resolves to a real path, and corresponds to an existing directory.
2021-05-02 20:00:19 +00:00
Dario Vladović
5118fb6561 feat: add Process.pid and Process.ppid foreign static methods to os module
Implement uv_os_getpid() and uv_os_getppid() bindings in process.c, register them in the CLI module table, expose as foreign statics in os.wren, and add a test suite verifying both return positive integers with pid greater than ppid.
2021-04-28 21:51:23 +00:00
Josh Goebel
7b56ba281b chore: update generated file headers to reference wren_to_c_string.py
Replace the generic "Do not edit" comment in all five `.wren.inc` files with a
more informative preamble that explicitly names the source `.wren` file and the
`util/wren_to_c_string.py` generator script, and update the script's own
`PREAMBLE` template accordingly.
2021-04-28 21:49:10 +00:00
Tarcisio Gruppi
1325fb747e fix: guard Process.arguments slice against insufficient argument count 2021-04-25 18:03:18 +00:00
Dario Vladović
5884beb109 feat: add Process.version static method exposing WREN_VERSION_STRING
Implement a new `Process.version` foreign static method that returns the Wren version string. The C implementation uses `wrenSetSlotString` with the `WREN_VERSION_STRING` macro, and the Wren binding registers it alongside existing `Process` methods. A new test file validates the returned value is a non-empty string composed of dot-separated numeric segments.
2020-06-14 04:23:02 +00:00
Dario Vladović
f0cc18f5ad feat: implement Process.cwd foreign method using libuv uv_cwd
Add a new `Process.cwd` static method that retrieves the current working directory via libuv's `uv_cwd` function. The implementation includes proper error handling that aborts the fiber with a descriptive message on failure. The foreign method is registered in the module table and exposed in the Wren API with a foreign static declaration. A test suite validates that the returned value is a non-empty string starting with "/", resolves correctly via `File.realPath`, and corresponds to an existing directory.
2020-06-14 04:12:34 +00:00
Bob Nystrom
7768d1c9cd feat: add Platform.isWindows static method to check for Windows OS
Add a new `isWindows` static method to the `Platform` class that returns `true` when the host operating system name equals "Windows". This provides a less stringly-typed API compared to checking `Platform.name` directly. The implementation is a simple delegation to the existing `name` foreign method, comparing it against the "Windows" string. Includes a test that verifies `Platform.isWindows` is equivalent to `Platform.name == "Windows"`.
2016-05-21 19:53:21 +00:00
Bob Nystrom
95ef1a2814 feat: rename process module to os and add Platform class with name and isPosix methods
Rename the "process" module to "os" across all source files, documentation, tests, and build configuration. Add a new Platform class to the os module with static methods `name` (returns OS string like "Windows", "Linux", "OS X", "iOS", "Unix", "POSIX", or "Unknown") and `isPosix` (returns bool indicating POSIX compliance). Update all import paths from "process" to "os" in test files and module registrations. Move process.c/h to os.c/h, rename processSetArguments to osSetArguments, and regenerate the os.wren.inc bytecode source. Add documentation pages for the os module and Platform class.
2016-05-21 19:44:17 +00:00