main.cpp 917 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <iostream>
  3. #include "core/entry.h"
  4. #include <filesystem>
  5. std::string config_filepath;
  6. bool start()
  7. {
  8. return fastweb_start(config_filepath.c_str()) == 0;
  9. }
  10. void close()
  11. {
  12. fastweb_close();
  13. }
  14. int main()
  15. {
  16. config_filepath = std::filesystem::current_path().string() + "/config.ini";
  17. std::string input = "restart";
  18. while (true)
  19. {
  20. if (input == "restart")
  21. {
  22. std::cout << "closing..." << std::endl;
  23. close();
  24. std::cout << "starting..." << std::endl;
  25. if (start() == false)
  26. {
  27. std::cin.get();
  28. return -1;
  29. }
  30. std::cout << "started" << std::endl;
  31. }
  32. else if (input == "quit" || input == "exit")
  33. {
  34. close();
  35. std::cout << "closed";
  36. break;
  37. }
  38. else
  39. {
  40. std::cout << "Enter \"quit\" or \"exit\" to exit the application" << std::endl;
  41. std::cout << "Enter \"restart\" to restart the application" << std::endl;
  42. }
  43. std::cin >> input;
  44. }
  45. return 0;
  46. }