summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd/yuzu.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-07-21 15:52:42 -0400
committerGravatar Lioncash2018-07-21 16:21:19 -0400
commitd66b43dadfac1e9324fee48e97361e2f858f8af5 (patch)
tree6007104127ffaa62cb5cb94f5c47fadf4c192fb8 /src/yuzu_cmd/yuzu.cpp
parentMerge pull request #754 from lioncash/part (diff)
downloadyuzu-d66b43dadfac1e9324fee48e97361e2f858f8af5.tar.gz
yuzu-d66b43dadfac1e9324fee48e97361e2f858f8af5.tar.xz
yuzu-d66b43dadfac1e9324fee48e97361e2f858f8af5.zip
file_util: Use an enum class for GetUserPath()
Instead of using an unsigned int as a parameter and expecting a user to always pass in the correct values, we can just convert the enum into an enum class and use that type as the parameter type instead, which makes the interface more type safe. We also get rid of the bookkeeping "NUM_" element in the enum by just using an unordered map. This function is generally low-frequency in terms of calls (and I'd hope so, considering otherwise would mean we're slamming the disk with IO all the time) so I'd consider this acceptable in this case.
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
-rw-r--r--src/yuzu_cmd/yuzu.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 24db1065a..b5392c499 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -56,6 +56,18 @@ static void PrintVersion() {
56 std::cout << "yuzu " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl; 56 std::cout << "yuzu " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;
57} 57}
58 58
59static void InitializeLogging() {
60 Log::Filter log_filter(Log::Level::Debug);
61 log_filter.ParseFilterString(Settings::values.log_filter);
62 Log::SetGlobalFilter(log_filter);
63
64 Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
65
66 const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
67 FileUtil::CreateFullPath(log_dir);
68 Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
69}
70
59/// Application entry point 71/// Application entry point
60int main(int argc, char** argv) { 72int main(int argc, char** argv) {
61 Config config; 73 Config config;
@@ -124,14 +136,7 @@ int main(int argc, char** argv) {
124 LocalFree(argv_w); 136 LocalFree(argv_w);
125#endif 137#endif
126 138
127 Log::Filter log_filter(Log::Level::Debug); 139 InitializeLogging();
128 log_filter.ParseFilterString(Settings::values.log_filter);
129 Log::SetGlobalFilter(log_filter);
130
131 Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
132 FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
133 Log::AddBackend(
134 std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
135 140
136 MicroProfileOnThreadCreate("EmuThread"); 141 MicroProfileOnThreadCreate("EmuThread");
137 SCOPE_EXIT({ MicroProfileShutdown(); }); 142 SCOPE_EXIT({ MicroProfileShutdown(); });