MCPcopy
hub / github.com/arduino/Arduino / renameTo

Method renameTo

arduino-core/src/processing/app/Sketch.java:292–308  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 5

performInstallMethod · 0.45
saveFileMethod · 0.45
nameCodeMethod · 0.45
saveMethod · 0.45
ensureOneLevelFolderMethod · 0.45

Calls 7

checkNewFoldernameMethod · 0.95
getFolderMethod · 0.95
getPrimaryFileMethod · 0.95
trMethod · 0.80
renamedToMethod · 0.80
getFileNameMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected