Check if renaming/saving this sketch to the given folder would cause a problem because: 1. The new folder already exists 2. Renaming the primary file would cause a conflict with an existing file. If so, an IOEXception is thrown. If not, the name of the new primary file is returned.
(File newFolder)
| 240 | * primary file is returned. |
| 241 | */ |
| 242 | protected File checkNewFoldername(File newFolder) throws IOException { |
| 243 | String newPrimary = FileUtils.addExtension(newFolder.getName(), DEFAULT_SKETCH_EXTENSION); |
| 244 | // Verify the new folder does not exist yet |
| 245 | if (newFolder.exists()) { |
| 246 | String msg = I18n.format(tr("Sorry, the folder \"{0}\" already exists."), newFolder.getAbsoluteFile()); |
| 247 | throw new IOException(msg); |
| 248 | } |
| 249 | |
| 250 | // If the folder is actually renamed (as opposed to moved somewhere |
| 251 | // else), check for conflicts using the new filename, but the |
| 252 | // existing folder name. |
| 253 | if (!newFolder.getName().equals(folder.getName())) |
| 254 | checkNewFilename(new File(folder, newPrimary)); |
| 255 | |
| 256 | return new File(newFolder, newPrimary); |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Check if renaming or adding a file would cause a problem because |
no test coverage detected