提交 001b1269 编写于 作者: M Mikhail Glukhikh

IO deprecations: String.separatorsToSystem() --> File.separatorsToSystem()...

IO deprecations: String.separatorsToSystem() --> File.separatorsToSystem() KT-9534, FileTreeWalk.filter --> FileTreeWalk.treeFilter KT-8517
上级 d78b59eb
......@@ -212,15 +212,26 @@ public class FileTreeWalk(private val start: File,
}
/**
* Sets filter [predicate].
* Filter [predicate] function is called before visiting files and entering directories.
* Sets tree filter [predicate].
* Tree filter [predicate] function is called before visiting files and entering directories.
* If it returns `false`, file is not visited, directory is not entered and all its content is also not visited.
* If it returns `true`, everything goes in the regular way.
*/
@Deprecated("Use treeFilter instead", ReplaceWith("treeFilter(predicate)"))
public fun filter(predicate: (File) -> Boolean): FileTreeWalk {
return FileTreeWalk(start, direction, enter, leave, fail, predicate, maxDepth)
}
/**
* Sets tree filter [predicate].
* Tree filter [predicate] function is called before visiting files and entering directories.
* If it returns `false`, file is not visited, directory is not entered and all its content is also not visited.
* If it returns `true`, everything goes in the regular way.
*/
public fun treeFilter(predicate: (File) -> Boolean): FileTreeWalk {
return FileTreeWalk(start, direction, enter, leave, fail, predicate, maxDepth)
}
/**
* Sets maximum [depth] of walk. Int.MAX_VALUE is used for unlimited.
* Negative and zero values are not allowed.
......
......@@ -90,6 +90,7 @@ public val File.extension: String
*
* @return the pathname with system separators.
*/
@Deprecated("Use File.separatorsToSystem instead", ReplaceWith("File(this).separatorsToSystem()", "java.io.File"))
public fun String.separatorsToSystem(): String {
val otherSep = if (File.separator == "/") "\\" else "/"
return replace(otherSep, File.separator)
......@@ -100,6 +101,7 @@ public fun String.separatorsToSystem(): String {
*
* @return the pathname with system separators.
*/
@Deprecated("This function is deprecated")
public fun String.pathSeparatorsToSystem(): String {
val otherSep = if (File.pathSeparator == ":") ";" else ":"
return replace(otherSep, File.pathSeparator)
......@@ -110,6 +112,7 @@ public fun String.pathSeparatorsToSystem(): String {
*
* @return the pathname with system separators.
*/
@Deprecated("This function is deprecated")
public fun String.allSeparatorsToSystem(): String {
return separatorsToSystem().pathSeparatorsToSystem()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册