9#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
36 mDirent = readdir(mNixDir);
39 throw Exception(
"Failed readdir", __FILE__, __LINE__);
44 mFile = mDirent->d_name;
45 mFullFilename = mPath +
'/' + mFile;
70 mDirent = readdir(mNixDir);
73 throw Exception(
"Failed readdir", __FILE__, __LINE__);
77 mFile = mDirent->d_name;
78 mFullFilename = mPath +
'/' + mFile;
89 return !(*
this == rhs);
96 if (mDirent && rhs.mDirent)
98 return **
this == *rhs;
101 return mDirent == rhs.mDirent;
121#if HAVE_STRUCT_DIRENT_D_TYPE
122 return mDirent->d_type == DT_DIR;
125 StackLog(<<
"calling stat() for " << mDirent->d_name);
126 if(stat(mFullFilename.c_str(), &s) < 0)
128 ErrLog(<<
"Error calling stat() for " << mFullFilename.c_str() <<
": " <<
strError(errno));
129 throw Exception(
"stat() failed", __FILE__, __LINE__);
131 return S_ISDIR(s.st_mode);
138 if(mkdir(mPath.
c_str(), 0777) == -1)
157 if (dir.getPath().empty() || dir.getPath().postfix(
"/") || dir.getPath().postfix(
"\\"))
159 searchPath = dir.getPath() +
Data(
"*");
163 searchPath = dir.getPath() +
Data(
"/*");
165 WIN32_FIND_DATAA fileData;
166 mWinSearch = FindFirstFileA( searchPath.
c_str(), &fileData);
168 if (mWinSearch == INVALID_HANDLE_VALUE)
174 mFile = fileData.cFileName;
175 mFullFilename = mPath +
'/' + mFile;
176 mIsDirectory = (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) > 0;
185 FindClose(mWinSearch);
193 WIN32_FIND_DATAA fileData;
195 if (!FindNextFileA(mWinSearch, &fileData))
197 if (GetLastError() == ERROR_NO_MORE_FILES)
199 FindClose(mWinSearch);
205 mFile = fileData.cFileName;
206 mFullFilename = mPath +
'/' + mFile;
207 mIsDirectory = (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) > 0;
216 return !(*
this == rhs);
223 if (mWinSearch && rhs.mWinSearch)
225 return **
this == *rhs;
229 return mWinSearch == rhs.mWinSearch;
256 if(_mkdir(mPath.c_str()) == -1)
258 return (
int)GetLastError();
static FileSystem::Directory::iterator staticEnd
#define resip_assert(x)
This file needs to work for both C and C++ code.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
const char * c_str() const
Returns a null-terminated string representing.
bool empty() const noexcept
Checks whether the Data is empty.
bool operator==(const iterator &rhs) const
const Data * operator->() const
bool operator!=(const iterator &rhs) const
bool is_directory() const
const Data & operator*() const
const Data & getPath() const
Directory(const Data &path)
dcm! – add UnusedChecking(_enum) below;
std::string strError(int err)