Hey everyone, hope I'm asking in the right channel...
# stdlib
d
Hey everyone, hope I'm asking in the right channel. Does there exist a standard multiplatform way to get the 'null' file i.e.
/dev/null
or
NUL
? Something like python's os.devnull.
h
AFAIK there is nothing in the Kotlin stdlib. And I also don't know of anything in Java either 😞
Copy code
val File.nullDevice: File
		get() {
			val isWindows = System.getProperty("os.name").startsWith("Windows", true)
			return File(if (isWindows) "NUL" else "/dev/null")
		}
🤷
d
Thanks 🙂