Lines Matching refs:path
37 File::File(const std::string &path, unsigned int mode) : mode_(mode)
39 if (path.empty()) {
44 OpenByRead(path);
49 fd_ = fopen(path.c_str(), "w+");
51 fd_ = fopen(path.c_str(), "a+");
55 Logger::E(TAG, "can't open '%s'", path.c_str());
59 path_ = RealPath(path);
67 void File::OpenByRead(const std::string &path)
69 if (!CheckValid(path)) {
70 Logger::E(TAG, "failed to check path '%s'", path.c_str());
74 std::string realPath = RealPath(path);
76 Logger::E(TAG, "invalid path '%s'", path.c_str());
204 bool File::CreateParentDir(const std::string &path)
206 if (access(path.c_str(), F_OK | R_OK | W_OK) == 0) {
211 while ((pos = path.find(SEPARATOR, pos)) != std::string::npos) {
212 std::string partPath = StringHelper::SubStr(path, 0, pos);
243 std::string File::AdapterPath(const std::string &path)
246 std::string newPath = StringHelper::Replace(path, '\\', '/');
248 std::string newPath = StringHelper::Replace(path, '/', '\\');
270 std::string File::AdapterRealPath(const std::string &path)
272 if (path.empty()) {
275 return RealPath(File::AdapterPath(path));
278 std::string File::RealPath(const std::string &path)
280 if (path.empty()) {
286 char *absPath = _fullpath(realPath, path.c_str(), PATH_MAX);
288 char *absPath = realpath(path.c_str(), realPath);
293 bool File::CheckValid(const std::string &path)
295 if (access(path.c_str(), F_OK | R_OK | W_OK) != 0) {
300 if (stat(path.c_str(), &st) < 0) {