X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDirList.cxx;h=6b95cf8f8b817eddbb63d93fd6e22c3a431df348;hb=8e10ae94ea66aca5adf40e66521fba9c736628c4;hp=4422a0a8434590af61cde2e9517a52ce61e25a22;hpb=038a3b7f67769dc20b4c46f3c9dcad7cc63d1161;p=gdcm.git diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index 4422a0a8..6b95cf8f 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/01/18 08:01:41 $ - Version: $Revision: 1.39 $ + Date: $Date: 2005/02/02 15:07:41 $ + Version: $Revision: 1.43 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -32,6 +32,7 @@ namespace gdcm { +//----------------------------------------------------------------------------- // Constructor / Destructor /** * \brief Constructor @@ -53,15 +54,15 @@ DirList::~DirList() //----------------------------------------------------------------------------- // Public - -/** - * \brief Print method - * @param os ostream to write to - */ -void DirList::Print(std::ostream &os) +bool DirList::IsDirectory(std::string const &dirName) { - std::copy(Filenames.begin(), Filenames.end(), - std::ostream_iterator(os, "\n")); +#ifndef _MSC_VER + 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 } //----------------------------------------------------------------------------- @@ -69,7 +70,6 @@ void DirList::Print(std::ostream &os) //----------------------------------------------------------------------------- // Private - /** * \brief Explore a directory with possibility of recursion * return number of files read @@ -149,6 +149,18 @@ int DirList::Explore(std::string const &dirpath, bool recursive) return numberOfFiles; } -} // end namespace gdcm //----------------------------------------------------------------------------- +// Print +/** + * \brief Print method + * @param os ostream to write to + */ +void DirList::Print(std::ostream &os) +{ + std::copy(Filenames.begin(), Filenames.end(), + std::ostream_iterator(os, "\n")); +} + +//----------------------------------------------------------------------------- +} // end namespace gdcm