diff --git a/container/src/root/macro/common/utility.hh b/container/src/root/macro/common/utility.hh index 83929d4..e819b1d 100644 --- a/container/src/root/macro/common/utility.hh +++ b/container/src/root/macro/common/utility.hh @@ -24,6 +24,7 @@ #define CONTAINER_SRC_ROOT_MACRO_COMMON_UTILITY_HH_ #include +#include #include #include #include @@ -72,6 +73,18 @@ class Command final //! \brief Load given file path static void load(const std::string& path) { + std::filesystem::path p(path); + if (!std::filesystem::exists(p)) + { + throw std::runtime_error( + std::string{"'" + path + "' does not exist!"}.c_str()); + } + if (!std::filesystem::is_regular_file(p)) + { + throw std::runtime_error( + std::string{"'" + path + "' is not a regular file!"}.c_str()); + } + std::string cmd{".L " + path}; Command::cmd_handler({cmd}); }