30 #if !defined(ZIPIOS_WINDOWS) && (defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32)) 31 #define ZIPIOS_WINDOWS 97 : m_recursive(recursive)
208 if(ent ==
nullptr || ent->isDirectory())
282 #ifdef ZIPIOS_WINDOWS 295 m_handle = _findfirsti64(path.getName().c_str(), &m_findinfo);
306 throw IOException(
"an I/O error occurred while reading a directory");
317 _findclose(m_handle);
325 __int64
const r(_findnexti64(m_handle, &m_fileinfo));
330 throw IOException(
"an I/O error occurred while reading a directory");
332 return std::string();
341 return m_fileinfo.name;
346 struct _finddata_t m_fileinfo;
347 bool m_read_first = 0;
353 : m_dir(opendir(static_cast<std::string>(path).c_str()))
357 throw IOException(
"an I/O error occurred while trying to access directory");
375 struct dirent * entry(readdir(m_dir));
380 throw IOException(
"an I/O error occurred while reading a directory");
382 return std::string();
385 return entry->d_name;
396 std::string
const& name(dir.next());
404 if(name !=
"." && name !=
"..")
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const
Get an entry from this collection.
The zipios namespace includes the Zipios library definitions.
std::shared_ptr< FileCollection > pointer_t
virtual FileEntry::vector_t entries() const override
Retrieve a vector to the collection entries.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
std::shared_ptr< std::istream > stream_pointer_t
A shared pointer to an input stream.
Define the zipios::DirectoryCollection class.
A collection generated from reading a directory.
virtual FileEntry::vector_t entries() const
Retrieve the array of entries.
virtual void close() override
Close the directory collection.
virtual pointer_t clone() const override
Create another DirectoryCollection.
DirectoryCollection()
Initialize a DirectoryCollection object.
FileEntry::vector_t m_entries
bool isDirectory() const
Check whether the file is a directory.
An IOException is used to signal an I/O error.
virtual void close()
Close the current FileEntry of this FileCollection.
void load(FilePath const &subdir)
This is the function loading all the file entries.
virtual void mustBeValid() const
Check whether the collection is valid.
void loadEntries() const
This is an internal function that loads the file entries.
bool isRegular() const
Check whether the file is a regular file.
Handle a file path and name and its statistics.
virtual ~DirectoryCollection() override
Clean up a DirectoryCollection object.
A file entry that does not use compression.
virtual stream_pointer_t getInputStream(std::string const &entry_name, MatchPath matchpath=MatchPath::MATCH) override
Retrieve pointer to an istream.
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const override
Get an entry from the collection.
std::shared_ptr< FileEntry > pointer_t
std::vector< pointer_t > vector_t