Skip to content

Add tests for using directory operations on files#5684

Merged
andrewrk merged 2 commits intoziglang:masterfrom
squeek502:fs-file-dir-ops
Jun 25, 2020
Merged

Add tests for using directory operations on files#5684
andrewrk merged 2 commits intoziglang:masterfrom
squeek502:fs-file-dir-ops

Conversation

@squeek502
Copy link
Member

Also fixes fs.Dir.openDir on Windows when called with a path to a file. Contributes towards #5653

cc @kubkon to make sure this would work for WASI (I'm unsure of how to test WASI).

@daurnimator daurnimator added os-windows Microsoft Windows standard library This issue involves writing Zig code for the standard library. and removed os-windows Microsoft Windows labels Jun 24, 2020
Copy link
Member

@kubkon kubkon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! As far as WASI is concerned, I think you've nailed it. tmpDir is the way to go which wraps either cwd or PreopenList depending if it's non-WASI or WASI host.

testing.expectError(error.NotDir, tmp_dir.dir.deleteDir(test_file_name));

if (builtin.os.tag != .wasi) {
// TODO: use Dir's realpath function once that exists
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps #5701 could be of use here (not necessarily saying to wait on it to land, just an FYI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

standard library This issue involves writing Zig code for the standard library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants