style: adjust clang-format rules (#2186)

Co-authored-by: Vithorio Polten <reach@vithor.io>
This commit is contained in:
ReenigneArcher
2025-01-19 22:34:47 -05:00
committed by GitHub
parent f57aee9025
commit c2420427b1
158 changed files with 8754 additions and 9994 deletions

View File

@ -12,8 +12,7 @@
#include "logging.h"
namespace file_handler {
std::string
get_parent_directory(const std::string &path) {
std::string get_parent_directory(const std::string &path) {
// remove any trailing path separators
std::string trimmed_path = path;
while (!trimmed_path.empty() && trimmed_path.back() == '/') {
@ -24,8 +23,7 @@ namespace file_handler {
return p.parent_path().string();
}
bool
make_directory(const std::string &path) {
bool make_directory(const std::string &path) {
// first, check if the directory already exists
if (std::filesystem::exists(path)) {
return true;
@ -34,19 +32,17 @@ namespace file_handler {
return std::filesystem::create_directories(path);
}
std::string
read_file(const char *path) {
std::string read_file(const char *path) {
if (!std::filesystem::exists(path)) {
BOOST_LOG(debug) << "Missing file: " << path;
return {};
}
std::ifstream in(path);
return std::string { (std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>() };
return std::string {(std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()};
}
int
write_file(const char *path, const std::string_view &contents) {
int write_file(const char *path, const std::string_view &contents) {
std::ofstream out(path);
if (!out.is_open()) {