# Pathos: Cross-platform file system library with experimental Windows support

**URL:** <https://forums.swift.org/t/pathos-cross-platform-file-system-library-with-experimental-windows-support/43120>\
**Category:** Community Showcase\
**Tags:** windows\
**Created:** [December 19, 2020, 7:38pm UTC](https://forums.swift.org/t/pathos-cross-platform-file-system-library-with-experimental-windows-support/43120 "2020-12-19T19:38:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![duan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/duan/32/40252_2.png) [@duan](https://forums.swift.org/u/duan)\
**Post date:** [December 19, 2020, 7:38pm UTC](https://forums.swift.org/t/pathos-cross-platform-file-system-library-with-experimental-windows-support/43120/1 "2020-12-19T19:38:30Z")

</div>

Hi, I recently rewrote Pathos, a VFS library that's been used in production for a few years. The goal of the rewrite is in the title: Windows!

Link: [GitHub - dduan/Pathos: File management and path analysis for Swift](https://github.com/dduan/Pathos)

Pathos is _cross-platform_. Meaning the same code written against it compiles and functions in the same manner without `#if os()`. It's API selection is comparable to Python's `os.path` (not as broad because Pathos focuses solely on manipulating the VFS).

If you are trying it out on Windows, please file any bugs you encounter :)

---

<div class="post-metadata">

**Author:** ![Karl](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Karl](https://forums.swift.org/u/Karl)\
**Post date:** [December 20, 2020, 5:53am UTC](https://forums.swift.org/t/pathos-cross-platform-file-system-library-with-experimental-windows-support/43120/2 "2020-12-20T05:53:56Z")

</div>

Very cool! I have a couple of questions/suggestions that are kind of more about how to work with paths in general, but I’d be interested to hear what you think of them:

- What do you think about adding a function to tell if 2 paths point to the same file?

- What do you think about making the working directory a library-internal property, rather than using the OS’s working directory?

Once again, nice work!

---

<div class="post-metadata">

**Author:** ![duan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/duan/32/40252_2.png) [@duan](https://forums.swift.org/u/duan)\
**Post date:** [December 20, 2020, 10:39pm UTC](https://forums.swift.org/t/pathos-cross-platform-file-system-library-with-experimental-windows-support/43120/3 "2020-12-20T22:39:19Z")

</div>

Thanks for checking Pathos out :)

> [@Karl](#):
>
> What do you think about adding a function to tell if 2 paths point to the same file?

Absolutely. This actually was in an earlier version of the library. It was implemented by comparing inode numbers I think. It's not in current version because:

1. I haven't figured out what an equivalent function should do on Windows
2. I'm not aware of any usage of it in production (but again, entire user behavior is unknowable, so I'm glad you bring it up with a brief look).

> [@Karl](#):
>
> What do you think about making the working directory a library-internal property, rather than using the OS’s working directory?

The reality is when it comes to file system, everything is shared and mutable by default. In comparison, the CWD being such for a single process isn't bad at all :P. I think I understand your reasoning for this suggestion, but people expect this API to exist generally (my mental model is scripting a shell), regardless of whether it's the best way to achieve what they want.
