Rename this sketch' folder to the given name. Unlike saveAs(), this moves the sketch directory, not leaving anything in the old place. This operation does not save the sketch, so the files on disk are moved, but not modified. @param newFolder The new folder name for this sketch. The new pr
(File newFolder)
| 290 | * already translated. |
| 291 | */ |
| 292 | public void renameTo(File newFolder) throws IOException { |
| 293 | // Check intended rename (throws if there is a problem) |
| 294 | File newPrimary = checkNewFoldername(newFolder); |
| 295 | |
| 296 | // Rename the sketch folder |
| 297 | if (!getFolder().renameTo(newFolder)) |
| 298 | throw new IOException(tr("Failed to rename sketch folder")); |
| 299 | |
| 300 | folder = newFolder; |
| 301 | |
| 302 | // Tell each file about its new name |
| 303 | for (SketchFile file : files) |
| 304 | file.renamedTo(new File(newFolder, file.getFileName())); |
| 305 | |
| 306 | // And finally, rename the primary file |
| 307 | getPrimaryFile().renameTo(newPrimary.getName()); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | public SketchFile addFile(String newName) throws IOException { |
no test coverage detected