From e390d89fdcd7cc59d09dc9ff59405e758c9a956d Mon Sep 17 00:00:00 2001
From: Bertrand Bellenot <Bertrand.Bellenot@cern.ch>
Date: Mon, 19 Mar 2012 08:19:55 +0000
Subject: [PATCH] Change the file name only if the selected entry is not a
 directory (as reported on the forum
 http://root.cern.ch/phpBB3//viewtopic.php?f=3&t=14370)

git-svn-id: http://root.cern.ch/svn/root/trunk@43377 27541ba8-7e3a-0410-8455-c3a389f83636
---
 gui/gui/src/TGFileDialog.cxx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gui/gui/src/TGFileDialog.cxx b/gui/gui/src/TGFileDialog.cxx
index 5cfc84a667f..fedcde4f359 100644
--- a/gui/gui/src/TGFileDialog.cxx
+++ b/gui/gui/src/TGFileDialog.cxx
@@ -535,10 +535,12 @@ Bool_t TGFileDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
                   if (fFc->NumSelected() > 0) {
                      if ( fFileInfo->fMultipleSelection == kFALSE ) {
                         TGLVEntry *e2 = (TGLVEntry *) fFc->GetNextSelected(&p);
-                        fTbfname->Clear();
-                        if ((e2) && (e2->GetItemName()))
-                           fTbfname->AddText(0, e2->GetItemName()->GetString());
-                        fClient->NeedRedraw(fName);
+                        if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
+                           fTbfname->Clear();
+                           if (e2->GetItemName())
+                              fTbfname->AddText(0, e2->GetItemName()->GetString());
+                           fClient->NeedRedraw(fName);
+                        }
                      }
                      else {
                         TString tmpString;
-- 
GitLab