Lines Matching refs:path
43 bool FileSystem::IsRegularFile(const std::string& path)
46 return (stat(path.c_str(), &s) == 0) && S_ISREG(s.st_mode);
71 bool FileSystem::IsDirectory(const std::string& path)
74 return (stat(path.c_str(), &s) == 0) && S_ISDIR(s.st_mode);
77 // judge regular file, directory, symbolic link file path exists
78 bool FileSystem::IsExists(const std::string& path)
80 return access(path.c_str(), 0) != -1;
83 bool FileSystem::MakeDir(const std::string& path)
86 if (mkdir(path.c_str()) == -1) {
87 MEDIA_LOG_E("Fail to create dir " PUBLIC_LOG_S " due to " PUBLIC_LOG_S, path.c_str(), std::strerror(errno));
94 if (mkdir(path.c_str(), 755) == -1) { // 755 directory access permissions
95 MEDIA_LOG_E("Fail to create dir " PUBLIC_LOG_S " due to " PUBLIC_LOG_S, path.c_str(), std::strerror(errno));
108 bool FileSystem::MakeMultipleDir(const std::string& path)
110 FALSE_RETURN_V(!IsExists(path), true);
113 // Avoid Linux root path before is empty string, which makes it impossible to judge whether the path exists
114 auto index = path.find('/', 1);
116 std::string tPath = path.substr(0, index);
118 index = path.find('/', index + 1);
120 return path[path.size() - 1] == '/' || MakeDir(path);
125 MEDIA_LOG_I("Clear file content path : " PUBLIC_LOG_S, fullPath.c_str());
134 void FileSystem::RemoveFilesInDir(const std::string& path)
137 if ((directory = opendir(path.c_str())) != nullptr) {
143 std::string fullPath = path + "/" + info->d_name;