From: regrain Date: Tue, 1 Feb 2005 10:00:34 +0000 (+0000) Subject: * src/gdcmDirList.cxx : bug fix to test a directory under linux X-Git-Tag: Version1.0.bp~141 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9d19fda44de366d43d8ee7606e21840b885c2bb8;p=gdcm.git * src/gdcmDirList.cxx : bug fix to test a directory under linux * Test/TestAllReadCompareDicom.cxx : remove obvious code -- BeNours --- diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index c605b7b3..4656a2c1 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDirList.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 09:46:15 $ - Version: $Revision: 1.40 $ + Date: $Date: 2005/02/01 10:00:34 $ + Version: $Revision: 1.41 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -153,8 +153,9 @@ int DirList::Explore(std::string const &dirpath, bool recursive) bool DirList::IsDirectory(std::string const &dirName) { #ifndef _MSC_VER - std::ifstream testDir(dirName.c_str(), std::ios::in | std::ios::binary); - return testDir != 0; + struct stat buf; + stat(dirName.c_str(), &buf); + return S_ISDIR(buf.st_mode); #else return (GetFileAttributes(dirName.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0; #endif