| ... | ... | @@ -22,16 +22,17 @@ pub const GetCwdError = posix.GetCwdError; |
| 22 | 22 | /// The result is a slice of `out_buffer`, from index `0`. |
| 23 | 23 | /// On Windows, the result is encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 24 | 24 | /// On other platforms, the result is an opaque sequence of bytes with no particular encoding. |
| 25 | | pub fn getCwd(out_buffer: []u8) ![]u8 { |
| 25 | pub fn getCwd(out_buffer: []u8) GetCwdError![]u8 { |
| 26 | 26 | return posix.getcwd(out_buffer); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | | pub const GetCwdAllocError = Allocator.Error || posix.GetCwdError; |
| 29 | // Same as GetCwdError, minus error.NameTooLong + Allocator.Error |
| 30 | pub const GetCwdAllocError = Allocator.Error || error{CurrentWorkingDirectoryUnlinked} || posix.UnexpectedError; |
| 30 | 31 | |
| 31 | 32 | /// Caller must free the returned memory. |
| 32 | 33 | /// On Windows, the result is encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 33 | 34 | /// On other platforms, the result is an opaque sequence of bytes with no particular encoding. |
| 34 | | pub fn getCwdAlloc(allocator: Allocator) ![]u8 { |
| 35 | pub fn getCwdAlloc(allocator: Allocator) GetCwdAllocError![]u8 { |
| 35 | 36 | // The use of max_path_bytes here is just a heuristic: most paths will fit |
| 36 | 37 | // in stack_buf, avoiding an extra allocation in the common case. |
| 37 | 38 | var stack_buf: [fs.max_path_bytes]u8 = undefined; |