]> Creatis software - gdcm.git/commitdiff
* src/gdcmDirList.cxx : bug fix to test a directory under linux
authorregrain <regrain>
Tue, 1 Feb 2005 10:00:34 +0000 (10:00 +0000)
committerregrain <regrain>
Tue, 1 Feb 2005 10:00:34 +0000 (10:00 +0000)
   * Test/TestAllReadCompareDicom.cxx : remove obvious code
   -- BeNours

src/gdcmDirList.cxx

index c605b7b3a137481f3943653a448593ff4b1ba1ba..4656a2c16d7fdf865acf537b5d50c01dcb9f630c 100644 (file)
@@ -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