checkCleanSafety
fun File.checkCleanSafety(sourceFile: File?, homeDirectory: File? = systemDirectory("user.home"), workingDirectory: File? = systemDirectory("user.dir")): CleanRefusal?
Decides whether this directory can be safely wiped by the CLI --clean flag.
Cleaning is refused when the target directory is a sensitive location (filesystem root, user home, the current working directory, or a project root), or when wiping it would delete the main sourceFile of the compilation.
Return
null if the directory can be cleaned, or a CleanRefusal describing why it cannot
Parameters
sourceFile
main source file of the compilation, if known
homeDirectory
user home directory, exposed as a parameter to ease testing
workingDirectory
current working directory, exposed as a parameter to ease testing