27 #include "precompiled.h"
52 const bool exists =
wstat(pathname, &s) == 0;
69 memset(&s, 0,
sizeof(s));
70 if(
wstat(pathname, &s) != 0)
108 for(
size_t i = 0; osEnt->
d_name[i] !=
'\0'; i++)
120 const OsPath pathname = path / name;
121 if(
wstat(pathname, &s) != 0)
125 if(files &&
S_ISREG(s.st_mode))
126 files->push_back(
CFileInfo(name, s.st_size, s.st_mtime));
127 else if(subdirectoryNames &&
S_ISDIR(s.st_mode) && name != L
"." && name != L
"..")
128 subdirectoryNames->push_back(name);
139 if(
wstat(path, &s) == 0)
154 if(
wmkdir(path, mode) != 0)
156 debug_printf(L
"CreateDirectories: failed to mkdir %ls (mode %d)", path.
string().c_str(), mode);
173 for(
size_t i = 0; i < files.size(); i++)
175 const OsPath pathname = path / files[i].Name();
182 for(
size_t i = 0; i < subdirectoryNames.size(); i++)
LIB_API int wrmdir(const OsPath &path)
WDIR * wopendir(const OsPath &path)
Status GetDirectoryEntries(const OsPath &path, CFileInfos *files, DirectoryNames *subdirectoryNames)
bool FileExists(const OsPath &pathname)
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
LIB_API int wunlink(const OsPath &pathname)
const String & string() const
u64 FileSize(const OsPath &pathname)
int wreaddir_stat_np(WDIR *, struct stat *)
wdirent * wreaddir(WDIR *)
i64 Status
Error handling system.
static Status Validate(String::value_type c)
LIB_API int wmkdir(const OsPath &path, mode_t mode)
std::vector< OsPath > DirectoryNames
#define WARN_RETURN(status)
Status DeleteDirectory(const OsPath &path)
Status CreateDirectories(const OsPath &path, mode_t mode)
bool DirectoryExists(const OsPath &path)
std::vector< CFileInfo > CFileInfos
void operator()(WDIR *osDir) const
LIB_API int wstat(const OsPath &pathname, struct stat *buf)
void debug_printf(const wchar_t *fmt,...)
write a formatted string to the debug channel, subject to filtering (see below).
Status GetFileInfo(const OsPath &pathname, CFileInfo *pPtrInfo)
#define RETURN_STATUS_IF_ERR(expression)