IOUtils

object IOUtils

Utility methods for file-based operations.

Functions

Link copied to clipboard

Computes an SHA-256 digest that represents the current state of file.

Link copied to clipboard

Recursively deletes the file or directory at path without following symbolic links: each link entry is removed, but the file or directory the link points to is left untouched. No-op if path does not exist.

Link copied to clipboard
fun isSubPath(parent: File, child: File): Boolean

Checks whether a child file is located in parent or any of its subdirectories. Symlinks are resolved to their real paths when possible, so that a symlink inside parent pointing outside it is correctly detected as not being a sub-path.

Link copied to clipboard
fun resolvePath(path: String, workingDirectory: File?): File

Resolves a File located in path, either relative or absolute. If the path is relative, the location is determined from the workingDirectory.

Link copied to clipboard
fun trySymlink(target: Path, source: Path): Boolean

Attempts to (re)create a symbolic link at target pointing to source. Returns true on success, false if symbolic links are unavailable on this platform (caller should fall back to a copy-based path).