simonc / memfs

MemFs provides a fake file system that can be used for tests. Strongly inspired by FakeFS.
MIT License
322 stars 27 forks source link

Add basic File::Stat#nlink method #39

Closed djberg96 closed 2 years ago

djberg96 commented 2 years ago

This adds a basic nlink method that's hard coded to 1 for files and 2 for directories, i.e. the defaults for simple cases.

Original issue at https://github.com/simonc/memfs/issues/35

I was going to try to do something more realistic, but wasn't satisified with my ultimately incomplete solution. There's probably a good way to accomplish it using internal methods, but it escaped me.

djberg96 commented 2 years ago

Looks like there are some unrelated CI issues.

simonc commented 2 years ago

Hey @djberg96 thanks for this PR. I'll merge it as-is and will take care of rubocop 😉 If anyone needs a more accurate/advanced nlink implementation it'll be a matter for later.

Thanks!