55{
56 const std::string me = argv[0];
57 std::map<std::string, std::list<std::string>>
filenames;
58
61
62#ifdef _WIN32
63
64
65 const auto logDirParent =
in_devmode() ? boost::filesystem::path(TOP_SRCDIR) : boost::dll::program_location().parent_path();
66 const auto logDir = logDirParent / "logs";
67 const auto logFile = logDir / fmt::format("scroom-log-{}.txt", getpid());
68
69 boost::filesystem::create_directory(logDir);
70
71 auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
72 auto file_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(logFile.string(), true);
73
74 auto spdlogger = std::make_shared<spdlog::logger>("scroom", spdlog::sinks_init_list{console_sink, file_sink});
75 loggerContainer->set(spdlogger);
76#else
77 auto spdlogger = loggerContainer->get();
78#endif
79
80 spdlogger->set_level(spdlog::level::trace);
81 spdlogger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%t] [%^%-5l%$] %v");
82
83 po::options_description desc("Available options");
84 desc.add_options()("help,h", "Show this help message")("load,l", po::value<std::vector<std::string>>(), "Load given filenames")(
85 "transparent-overlay", po::value<std::vector<std::string>>()->multitoken(), "Show given files in transparent overlay"
86 );
87
88 po::positional_options_description
p;
90
91 po::variables_map vm;
92
93 try
94 {
95 po::store(po::command_line_parser(argc, argv).options(desc).positional(
p).run(), vm);
96 po::notify(vm);
97
98 if(vm.count("help"))
99 {
100 usage(logger, me, desc);
101 }
102
103 if(vm.count("load"))
104 {
105 const auto& names = vm["load"].as<std::vector<std::string>>();
107 }
108
109 if(vm.count("transparent-overlay"))
110 {
111 const auto& names = vm["transparent-overlay"].as<std::vector<std::string>>();
112 filenames[
"Transparent Overlay"].assign(names.begin(), names.end());
113 }
114 }
115 catch(std::exception& ex)
116 {
117 usage(logger, me, desc, ex.what());
118 }
119
120 setlocale(LC_ALL, "");
121 gtk_init(&argc, &argv);
122
124
125 gtk_main();
126
128 logger->debug(
"Scroom terminating...");
129 return 0;
130}
bool in_devmode()
Definition callbacks.cc:422
const std::string REGULAR_FILES
Definition callbacks.cc:46
void on_scroom_terminating()
Definition callbacks.cc:485
static FileNameMap filenames
Definition callbacks.cc:60
void on_scroom_bootstrap(const FileNameMap &newFilenames)
Definition callbacks.cc:424
static Ptr instance()
Definition logger.cc:21
PresentationInterfaceStub::Ptr const p
Definition determine-size-test.cc:172
void usage(const Scroom::Logger &logger, const std::string &me, const po::options_description &desc, const std::string &message=std::string())
Definition main.cc:35
Scroom::Logger logger
Definition callbacks.cc:54