Skip to content

Commit 144213f

Browse files
authored
Merge pull request arduino#6388 from matthijskooijman/fix-renaming-new-files
Fix renaming of newly added files
2 parents 91cdf53 + beadf8f commit 144213f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arduino-core/src/processing/app/SketchFile.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private boolean deleteCompiledFilesFrom(Path tempBuildFolder) throws IOException
177177
public void renameTo(String newName) throws IOException {
178178
File newFile = new File(file.getParentFile(), newName);
179179
sketch.checkNewFilename(newFile);
180-
if (file.renameTo(newFile)) {
180+
if (!file.exists() || file.renameTo(newFile)) {
181181
renamedTo(newFile);
182182
} else {
183183
String msg = I18n.format(tr("Failed to rename \"{0}\" to \"{1}\""), file.getName(), newName);

0 commit comments

Comments
 (0)