Merge pull request #6388 from matthijskooijman/fix-renaming-new-files

Fix renaming of newly added files
This commit is contained in:
Martino Facchin 2017-08-01 11:45:29 +02:00 committed by GitHub
commit 144213fb8a
1 changed files with 1 additions and 1 deletions

View File

@ -177,7 +177,7 @@ public class SketchFile {
public void renameTo(String newName) throws IOException {
File newFile = new File(file.getParentFile(), newName);
sketch.checkNewFilename(newFile);
if (file.renameTo(newFile)) {
if (!file.exists() || file.renameTo(newFile)) {
renamedTo(newFile);
} else {
String msg = I18n.format(tr("Failed to rename \"{0}\" to \"{1}\""), file.getName(), newName);