FileExistenceEvaluator.cpp 1012 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2023-02-21
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include <ls-std/core/exception/FileNotFoundException.hpp>
  11. #include <ls-std/io/File.hpp>
  12. #include <ls-std/io/evaluator/FileExistenceEvaluator.hpp>
  13. #include <string>
  14. using ls::standard::core::Class;
  15. using ls::standard::core::FileNotFoundException;
  16. using ls::standard::io::File;
  17. using ls::standard::io::FileExistenceEvaluator;
  18. using std::move;
  19. using std::string;
  20. FileExistenceEvaluator::FileExistenceEvaluator(string _filePath) : Class("FileExistenceEvaluator"), filePath(::move(_filePath))
  21. {}
  22. FileExistenceEvaluator::~FileExistenceEvaluator() noexcept = default;
  23. void FileExistenceEvaluator::evaluate()
  24. {
  25. if (!File{this->filePath}.exists())
  26. {
  27. const string message = "\"" + this->filePath + "\" does not exist!";
  28. throw FileNotFoundException{message};
  29. }
  30. }