Go to the documentation of this file.
37 #include <sys/types.h>
39 #define WIN32_LEAN_AND_MEAN // yeah, right
63 using google::protobuf::io::win32::chdir;
64 using google::protobuf::io::win32::fopen;
65 using google::protobuf::io::win32::mkdir;
66 using google::protobuf::io::win32::stat;
75 FILE* file = fopen(
name.c_str(), text_mode ?
"rt" :
"rb");
76 if (file ==
NULL)
return false;
84 int error = ferror(file);
85 if (fclose(file) != 0)
return false;
94 FILE* file = fopen(
name.c_str(),
"wb");
100 if (fwrite(contents.data(), 1, contents.size(), file) != contents.size()) {
106 if (fclose(file) != 0) {
113 FILE* file = fopen(
name.c_str(),
"wb");
127 return mkdir(
name.c_str(),
mode) == 0;
136 string::size_type slashpos =
path.find_last_of(
'/');
137 if (slashpos == string::npos) {
147 void* dummy1,
void*
dummy2) {
148 if (
name.empty())
return;
155 WIN32_FIND_DATAA find_data;
156 HANDLE find_handle = FindFirstFileA((
name +
"/*").c_str(), &find_data);
157 if (find_handle == INVALID_HANDLE_VALUE) {
159 DeleteFileA(
name.c_str());
160 RemoveDirectoryA(
name.c_str());
165 string entry_name = find_data.cFileName;
166 if (entry_name !=
"." && entry_name !=
"..") {
167 string path =
name +
"/" + entry_name;
168 if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
170 RemoveDirectoryA(
path.c_str());
172 DeleteFileA(
path.c_str());
175 }
while(FindNextFileA(find_handle, &find_data));
176 FindClose(find_handle);
178 RemoveDirectoryA(
name.c_str());
183 if (lstat(
name.c_str(), &stats) != 0)
return;
190 if (entry ==
NULL)
break;
191 string entry_name = entry->
d_name;
192 if (entry_name !=
"." && entry_name !=
"..") {
201 }
else if (
S_ISREG(stats.st_mode)) {
202 remove(
name.c_str());
208 return chdir(new_working_directory.c_str()) == 0;
#define GOOGLE_CHECK_EQ(A, B)
GLuint const GLchar * name
static struct dirent * readdir(DIR *dirp)
static void WriteStringToFileOrDie(const string &contents, const string &name)
static int closedir(DIR *dirp)
static bool WriteStringToFile(const string &contents, const string &name)
GLuint GLint GLboolean GLint GLenum access
GLsizei const GLchar ** path
static void ReadFileToStringOrDie(const string &name, string *output)
#define GOOGLE_LOG(LEVEL)
static const LogLevel ERROR
static bool ReadFileToString(const string &name, string *output, bool text_mode=false)
#define GOOGLE_CHECK(EXPRESSION)
#define GOOGLE_CHECK_OK(A)
static bool RecursivelyCreateDir(const string &path, int mode)
static bool ChangeWorkingDirectory(const string &new_working_directory)
char * strerror(int errno)
static DIR * opendir(const char *dirname)
const upb_json_parsermethod const upb_symtab upb_sink * output
static bool CreateDir(const string &name, int mode)
static void DeleteRecursively(const string &name, void *dummy1, void *dummy2)
static bool Exists(const string &name)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51