| 225 | } |
| 226 | |
| 227 | bool FileSystemUtil::IsCanonicalPath(const string& path) { |
| 228 | return !path.empty() |
| 229 | && path.front() == '/' |
| 230 | && (path.length() == 1 || path.back() != '/') |
| 231 | && (path.length() == 1 || strcmp(path.c_str() + path.length() - 2, "/.") != 0) |
| 232 | && (path.length() <= 2 || strcmp(path.c_str() + path.length() - 3, "/..") != 0) |
| 233 | && strstr(path.c_str(), "//") == nullptr |
| 234 | && strstr(path.c_str(), "/./") == nullptr |
| 235 | && strstr(path.c_str(), "/../") == nullptr; |
| 236 | } |
| 237 | |
| 238 | Status FileSystemUtil::IsSymbolicLink(const string& file_path, bool* is_symbolic_link, |
| 239 | string* canonical_path) { |