Skip to content

Toolkit Files and Processes missing io.File and nio.Path interop details #2883

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

Closed
DavidGoodenough opened this issue Aug 9, 2023 · 4 comments · Fixed by #2885
Closed

Toolkit Files and Processes missing io.File and nio.Path interop details #2883

DavidGoodenough opened this issue Aug 9, 2023 · 4 comments · Fixed by #2885
Assignees

Comments

@DavidGoodenough
Copy link

In the section https://docs.scala-lang.org/toolkit/os-intro.html there is information on how to use op.Path and friends on its own, but nothing about how to convert java.io.File and java.nio.Path objects to and from os.Path.

As this site is going to be the first place that new users visit before using the Toolkit, and in many cases there will be need to use the old Java classes to integrate with other libraries (such as JavaFX and its file and directory choosers) the lack of any mention of interworking is likely to put people off trying the Toolkit.

In addition the context prompts in IDEs such as VsCode do not offer the implicit conversions, so when you got to create an os.Path you are not offered the ability to pass it an io.File, just the ability to pass it a PathConvert or String.

So I would suggest a short extra page, or an extra paragraph on the last page in the os-intro section which says something like:-

os.Path objects can be created from existing java.io.File and java.nio.Path objects by passing them to the constructor/apply, and if you need to get an io.File you can use the toIo method, and for an nio.Path the toNio method.

@SethTisue
Copy link
Member

where is the relevant documentation in the main OS-Lib repo? could we just link to that?

@DavidGoodenough
Copy link
Author

I really think a single paragraph saying that it is possible would be helpful to newbies, then they know it is worth looking in the docs.

The best place would be in https://docs.scala-lang.org/toolkit/os-what-else.html

@SethTisue SethTisue self-assigned this Aug 11, 2023
SethTisue added a commit to SethTisue/docs.scala-lang that referenced this issue Aug 13, 2023
@SethTisue
Copy link
Member

PR: #2885

@DavidGoodenough
Copy link
Author

Looks good, thank you

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 a pull request may close this issue.

2 participants