mkdir2

@JvmOverloads
fun File.mkdir2(mode: String?, mustCreate: Boolean = false): File(source)

Creates the directory named by this abstract pathname.

Return

The File for chaining operations.

Parameters

mode

The permissions to set for the newly created directory. Must be 3 digits, each being between 0 and 7 (inclusive). If null, default directory permissions 777 will be used.

mustCreate

If false, failure to create the directory due to it already existing on the filesystem will return safely, instead of throwing FileAlreadyExistsException. If true, then the FileAlreadyExistsException will be thrown. Default false.

See also

Throws

IllegalArgumentException

if mode is inappropriate.

If there was a failure to create the directory, such as its parentPath not existing, or its parentPath points to a File that is not a directory, or the filesystem threw a security exception.

UnsupportedOperationException

On Kotlin/JS-Browser.