| 34 | |
| 35 | |
| 36 | std::error_code canonicalize(const llvm::Twine &path, llvm::SmallVectorImpl<char> &result) { |
| 37 | std::string p = path.str(); |
| 38 | #ifdef PATH_MAX |
| 39 | int path_max = PATH_MAX; |
| 40 | #else |
| 41 | int path_max = pathconf(p.c_str(), _PC_PATH_MAX); |
| 42 | if (path_max <= 0) |
| 43 | path_max = 4096; |
| 44 | #endif |
| 45 | result.resize(path_max); |
| 46 | realpath(p.c_str(), result.data()); |
| 47 | result.resize(strlen(result.data())); |
| 48 | return {}; |
| 49 | } |
| 50 | |
| 51 | /* Based on the one from Support/Unix/PathV2 but with different default rights */ |
| 52 | static std::error_code create_directory(const llvm::Twine& path) |
no outgoing calls
no test coverage detected