// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include "../common/JFJochException.h" inline void MakeDirectory(const std::string &input) { try { std::filesystem::path path(input); if (path.has_parent_path()) std::filesystem::create_directories(path.parent_path()); } catch (const std::filesystem::filesystem_error &err) { throw JFJochException(JFJochExceptionCategory::FileWriteError, "Cannot create subdirectory for file " + input + ": " + std::string(err.what())); } }