IO deprecations: String.separatorsToSystem() --> File.separatorsToSystem() KT-9534, FileTreeWalk.filter --> FileTreeWalk.treeFilter KT-8517

This commit is contained in:
Mikhail Glukhikh
2015-10-13 19:01:20 +03:00
parent d78b59eb73
commit 001b1269b9
2 changed files with 16 additions and 2 deletions
@@ -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()
}