Merge pull request #1096 from sidheshenator/FileUtil_Sanity_Check

sanity check added to FileUtil.deleteDir()
This commit is contained in:
Brian Carrier 2015-03-13 09:28:12 -04:00
commit 2c7fb17a19

View File

@ -38,7 +38,10 @@ import org.openide.filesystems.FileObject;
* @return true if the dir deleted, false otherwise
*/
public static boolean deleteDir(File dirPath) {
if (dirPath.exists()) {
if(dirPath.isFile())
return false;
if (dirPath.isDirectory() && dirPath.exists()) {
File[] files = dirPath.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {