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.
8 lines
323 B
JavaScript
Vendored
8 lines
323 B
JavaScript
Vendored
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
|