Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Extensions for 'Path' from JDK7 #2

Closed
wants to merge 1 commit into from

Conversation

superbobry
Copy link

This is a work in progress.

The current version is basically a copy/paste of the extensions we use internally. I think this already allows for much better code than Files.foo(Files.bar(...), Files.boo()). However, there's also an option of mirroring the API Kotlin provides for File.

I'm not sure which way is best, what do you think?

import java.util.stream.Collectors

/** Converts a path string to a [Path]. */
inline fun String.toPath() = Paths.get(this)
Copy link
Member

@ilya-g ilya-g Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider also pathOf(String): Path and pathOf(vararg String): Path functions.

@osipxd
Copy link

osipxd commented May 3, 2019

Is there any progress on it?

@ilya-g
Copy link
Member

ilya-g commented Nov 25, 2020

Starting from 1.4.20, Kotlin provides experimental extensions for java.nio.file.Path as a part of kotlin-stdlib-jdk7 artifact: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/

So, I'm closing this PR as obsolete.

@ilya-g ilya-g closed this Nov 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants