# HG changeset patch
# User Edouard Tisserant
# Date 1518616120 -3600
# Node ID 65d2dbbf702290c45bbb076dfe41b9672d83ed49
# Parent  7e6b03251bfe9d5ad9b2a79381af4ec8fbe3ddf3
Better variable naming, and small optimization.

diff -r 7e6b03251bfe -r 65d2dbbf7022 ConfigTreeNode.py
--- a/ConfigTreeNode.py	Tue Feb 13 14:01:20 2018 +0100
+++ b/ConfigTreeNode.py	Wed Feb 14 14:48:40 2018 +0100
@@ -410,15 +410,16 @@
             res = "%s_%d" % (BaseDesiredName, suffix)
             suffix += 1
 
-        # Get old path
-        oldname = self.CTNPath()
         # Check previous confnode existance
         dontexist = self.BaseParams.getName() == "__unnamed__"
+        if not dontexist:
+            # Get old path
+            oldpath = self.CTNPath()
         # Set the new name
         self.BaseParams.setName(res)
         # Rename confnode dir if exist
         if not dontexist:
-            shutil.move(oldname, self.CTNPath())
+            shutil.move(oldpath, self.CTNPath())
         # warn user he has two left hands
         if DesiredName != res:
             msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1=DesiredName, a2=res)