9 bool IO::MkDir( const std::string
& dir
)
11 return CreateDirectory( dir
.c_str(), NULL
) != 0;
14 bool IO::RmDir( const std::string
& dir
)
16 return RemoveDirectory( dir
.c_str() ) != 0;
19 Directory::Directory()
20 : m_handle( INVALID_HANDLE_VALUE
)
24 Directory::~Directory()
26 if( m_handle
!= INVALID_HANDLE_VALUE
)
28 FindClose( m_handle
);
32 bool Directory::Open( const std::string
& dir
)
35 m_handle
= FindFirstFile( m_path
.c_str(), &m_ffd
);
37 return m_handle
!= INVALID_HANDLE_VALUE
;
40 std::string
Directory::GetName()
42 return m_ffd
.cFileName
;
45 Directory
& Directory::operator++()
47 if( FindNextFile( m_handle
, &m_ffd
) == 0 )
49 FindClose( m_handle
);
50 m_handle
= INVALID_HANDLE_VALUE
;
55 Directory::operator bool()
57 return m_handle
!= INVALID_HANDLE_VALUE
;
62 bool IO::MkDir( const std::string
& dir
)
64 return mkdir( dir
.c_str(), S_IRWXU
| S_IRGRP
| S_IXGRP
| S_IROTH
| S_IXOTH
) == 0;
67 bool IO::RmDir( const std::string
& dir
)
69 return rmdir( dir
.c_str() ) == 0;
72 Directory::Directory()
77 Directory::~Directory()
82 bool Directory::Open( const std::string
& dir
)
84 m_dir
= opendir( dir
.c_str() );
85 m_dirent
= readdir( m_dir
);
90 std::string
Directory::GetName()
92 return m_dirent
->d_name
;
95 Directory
& Directory::operator++()
97 m_dirent
= readdir( m_dir
);
101 Directory::operator bool()
103 return m_dirent
!= NULL
;