Creates the directory named by the trailing filename of this file, including the complete directory path required to create this directory. @return true if the necessary directories have been created, false if the target directory already exists or one of the directo
()
| 1186 | * @see #mkdir |
| 1187 | */ |
| 1188 | public boolean mkdirs() { |
| 1189 | /* If the terminal directory already exists, answer false */ |
| 1190 | if (exists()) { |
| 1191 | return false; |
| 1192 | } |
| 1193 | |
| 1194 | /* If the receiver can be created, answer true */ |
| 1195 | if (mkdir()) { |
| 1196 | return true; |
| 1197 | } |
| 1198 | |
| 1199 | String parentDir = getParent(); |
| 1200 | /* If there is no parent and we were not created, answer false */ |
| 1201 | if (parentDir == null) { |
| 1202 | return false; |
| 1203 | } |
| 1204 | |
| 1205 | /* Otherwise, try to create a parent directory and then this directory */ |
| 1206 | return (new File(parentDir).mkdirs() && mkdir()); |
| 1207 | } |
| 1208 | |
| 1209 | /** |
| 1210 | * Creates a new, empty file on the file system according to the path |