We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3bdf16 commit 401c02dCopy full SHA for 401c02d
1 file changed
common/src/main/kotlin/com/lambda/util/FileUtils.kt
@@ -90,10 +90,12 @@ object FileUtils {
90
* @param block Lambda executed if the file doesn't exist or the file is empty
91
*/
92
inline fun File.createIfNotExists(block: (File) -> Unit): File {
93
- if (length() == 0L) block(this)
+ if (length() == 0L) {
94
+ parentFile.mkdirs()
95
+ createNewFile()
96
- parentFile.mkdirs()
- createNewFile()
97
+ block(this)
98
+ }
99
100
return this
101
}
0 commit comments