Copies `s` into `buf` as a null-terminated C string, truncating to fit if necessary (path_buf is a fixed-size ImGui InputText backing buffer).
| 53 | // Copies `s` into `buf` as a null-terminated C string, truncating to fit |
| 54 | // if necessary (path_buf is a fixed-size ImGui InputText backing buffer). |
| 55 | void set_path_buf(std::array<char, 1024>& buf, std::string_view s) { |
| 56 | const std::size_t n = (std::min)(s.size(), buf.size() - 1); |
| 57 | std::copy_n(s.begin(), n, buf.begin()); |
| 58 | buf[n] = '\0'; |
| 59 | } |
| 60 | |
| 61 | } // namespace |
| 62 |
no test coverage detected