From 046c08cb673e7203588a9c551d8c54c5d0bf9ed9 Mon Sep 17 00:00:00 2001
From: Vishesh Handa <me@vhanda.in>
Date: Fri, 27 Dec 2019 00:37:26 +0100
Subject: [PATCH] Folder rename: Only udpate 'folderPath' once rename is
 successfull

---
 lib/core/notes_folder.dart | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/core/notes_folder.dart b/lib/core/notes_folder.dart
index 7cfe578e..ab66f776 100644
--- a/lib/core/notes_folder.dart
+++ b/lib/core/notes_folder.dart
@@ -268,8 +268,8 @@ class NotesFolder with ChangeNotifier implements Comparable<NotesFolder> {
   void rename(String newName) {
     var dir = Directory(folderPath);
     var parentDirName = dirname(folderPath);
-    folderPath = p.join(parentDirName, newName);
     dir.renameSync(folderPath);
+    folderPath = p.join(parentDirName, newName);
 
     notifyListeners();
   }