Retoor software development Projects Research SearchXNG
Register Sign In

8 lines
323 B
JavaScript
Raw Normal View History

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 22:00:19 +02:00
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 Copy Permalink
eadfc8e9cb
wren/test/os/platform/homedir.wren
Response time: 1557ms
Mail Licenses API