Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement path_remove_directory and path_unlink_file system calls #50

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

Prakhar-Agarwal-byte
Copy link
Contributor

Fixes #49

This adds support for the path_remove_directory and path_unlink_file system calls.

Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>
@Prakhar-Agarwal-byte
Copy link
Contributor Author

We have tested the path_unlink_file, and it works as it should but path_remove_directory is getting stuck in an infinite loop, will fix that soon.

Would love to get some feedback on this approach.

Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>
Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>
@Prakhar-Agarwal-byte Prakhar-Agarwal-byte changed the title [WIP] feat: implement path_remove_directory and path_unlink_file system calls feat: implement path_remove_directory and path_unlink_file system calls Nov 18, 2023
@Prakhar-Agarwal-byte
Copy link
Contributor Author

@bjorn3 I have fixed the bug, its working fine now

src/fs_fd.ts Outdated
return wasi.ERRNO_NOENT;
}
if (entry.stat().filetype === wasi.FILETYPE_DIRECTORY) {
console.log("file is actually a directory");
Copy link
Owner

@bjorn3 bjorn3 Nov 21, 2023

Choose a reason for hiding this comment

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

Please replace this and the other console.log below with debug.log or remove them entirely.

src/fs_core.ts Outdated
@@ -122,6 +122,28 @@ export class Directory {
return entry;
}

get_parent_dir_for_path(
path: string,
): File | Directory | SyncOPFSFile | null {
Copy link
Owner

Choose a reason for hiding this comment

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

This function can only return a Directory or null, right?

@bjorn3
Copy link
Owner

bjorn3 commented Nov 21, 2023

Thanks!

@bjorn3 bjorn3 merged commit 88878d6 into bjorn3:main Nov 21, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature request: Implement both path_remove_directory and path_unlink_file
2 participants