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

Support path arguments for native #492

Open
mgroth0 opened this issue Mar 5, 2024 · 3 comments
Open

Support path arguments for native #492

mgroth0 opened this issue Mar 5, 2024 · 3 comments

Comments

@mgroth0
Copy link

mgroth0 commented Mar 5, 2024

Title says it all. Using something like kotlinx-io to support even a subset of the path features in native would be excellent

@JakeWharton
Copy link

Since that library is not stable, you're better off doing a manual convert for now. I suspect once it does go stable it will be supported.

You could also use Okio's multiplatform file system. It is stable, but I wouldn't expect Clikt to take it as a dependency for built-in support. Example:

https://github.com/JakeWharton/video-swatch/blob/trunk/src/commonMain/kotlin/com/jakewharton/videoswatch/main.kt#L69-L70

@ajalt
Copy link
Owner

ajalt commented Mar 5, 2024

I don't generally have library-specific extensions since calling .convert { it.toWhatever } seems easy enough. But since paths have some extra validation functionality like canBeFolder, it might make sense to provide that once kotlinx-io is stable.

@mgroth0
Copy link
Author

mgroth0 commented Mar 15, 2024

@JakeWharton I actually wasn't aware about okio for native filesystem operations. I tried it and it is working really well. Thank you!

And @ajalt, you are right and that is exactly why I made this issue. Because the JVM API is more than just a conversion but also has fancy checks like canBeFolder, it would seem beneficial to support than more evenly across platforms if possible.

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

No branches or pull requests

3 participants