Revision 37599 branches/v2_0_0_prep/extensions/org.gvsig.installer/org.gvsig.installer.lib/org.gvsig.installer.lib.impl/src/main/java/org/gvsig/installer/lib/impl/utils/DeleteFile.java
DeleteFile.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.io.File; |
25 | 25 |
|
26 |
|
|
27 | 26 |
/** |
28 | 27 |
* @author gvSIG Team |
29 | 28 |
* @version $Id$ |
30 |
* |
|
29 |
*
|
|
31 | 30 |
*/ |
32 | 31 |
public class DeleteFile { |
33 | 32 |
|
34 |
|
|
35 |
public DeleteFile() { |
|
33 |
public DeleteFile() { |
|
36 | 34 |
|
37 |
}
|
|
38 |
|
|
39 |
public boolean delete(File dir) {
|
|
40 |
if (dir.isDirectory()) {
|
|
41 |
String[] children = dir.list();
|
|
42 |
for (int i = 0; i < children.length; i++) {
|
|
43 |
boolean success = delete(new File(dir, children[i]));
|
|
44 |
if (!success) {
|
|
45 |
return false;
|
|
46 |
}
|
|
47 |
}
|
|
48 |
}
|
|
49 |
return dir.delete();
|
|
50 |
}
|
|
51 |
|
|
35 |
}
|
|
36 |
|
|
37 |
public boolean delete(File dir) {
|
|
38 |
if (dir.isDirectory()) {
|
|
39 |
String[] children = dir.list();
|
|
40 |
for (int i = 0; i < children.length; i++) {
|
|
41 |
boolean success = delete(new File(dir, children[i]));
|
|
42 |
if (!success) {
|
|
43 |
return false;
|
|
44 |
}
|
|
45 |
}
|
|
46 |
}
|
|
47 |
return dir.delete();
|
|
48 |
}
|
|
49 |
|
|
52 | 50 |
} |
Also available in: Unified diff