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.
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import "io" for File, Directory
|
||||
import "os" for Platform
|
||||
|
||||
System.print(Platform.homePath is String) // expect: true
|
||||
System.print(!Platform.homePath.isEmpty) // expect: true
|
||||
System.print(File.realPath(Platform.homePath) == Platform.homePath) // expect: true
|
||||
System.print(Directory.exists(Platform.homePath)) // expect: true
|
||||
Reference in New Issue
Block a user