Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #104 from jin/symlinks
Browse files Browse the repository at this point in the history
Do not delete files in symlinks when overwriting project
  • Loading branch information
borisf authored Apr 29, 2018
2 parents a0ca347 + 764887a commit 41ab6c7
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.google.androidstudiopoet.writers

import org.apache.commons.io.FileUtils
import java.io.File

interface AbstractWriter {
Expand All @@ -14,7 +15,9 @@ interface AbstractWriter {

fun delete(path: String) {
val file = File(path)
file.listFiles()?.forEach { delete(it.absolutePath) }
if (!FileUtils.isSymlink(file)) {
file.listFiles()?.forEach { delete(it.absolutePath) }
}
file.delete()
}
}

0 comments on commit 41ab6c7

Please sign in to comment.