WebAssemblyOS / wasmos

OS primitives and shell for AssembyScript and WebAssembly
MIT License
42 stars 21 forks source link

How to know what the current directory is? #114

Open fiorig opened 5 years ago

fiorig commented 5 years ago

I am working on 'cd' and thus far I have been using stdout and stderr, like the examples, to test for the correctness of my code. However, I was wondering if there is a way or a function to actually see what the current directory is?

99

willemneal commented 5 years ago

I just pushed some changes to your branch which includes another students version of ls. You can access the current working directory with fs.cwd, which has a getter and setter. You need to pass it a file descriptor reference, e.i. fd. If you look at ls it shows an example of reading from it for ls with no arguments.