summaryrefslogtreecommitdiff
path: root/src/common/string_util.cpp
diff options
context:
space:
mode:
authorGravatar Daniel Lim Wee Soong2018-03-22 18:21:29 +0800
committerGravatar Daniel Lim Wee Soong2018-03-22 18:21:29 +0800
commit3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e (patch)
treec6e2a53e92f1ef289edf26212a0f82fb0c97e718 /src/common/string_util.cpp
parentMerge pull request #215 from N00byKing/umapsharedmmry (diff)
downloadyuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.gz
yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.xz
yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.zip
Logging: Create logging macros based on fmtlib
Add a new set of logging macros based on fmtlib Similar but not exactly the same as https://github.com/citra-emu/citra/pull/3533 Citra currently uses a different version of fmt, which does not support FMT_VARIADIC so make_args is used instead. On the other hand, yuzu uses fmt 4.1.0 which doesn't have make_args yet so FMT_VARIADIC is used.
Diffstat (limited to '')
-rw-r--r--src/common/string_util.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index e9a2a6b00..124a8937f 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -462,4 +462,27 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_l
462 462
463 return std::string(buffer, len); 463 return std::string(buffer, len);
464} 464}
465
466const char* TrimSourcePath(const char* path, const char* root) {
467 const char* p = path;
468
469 while (*p != '\0') {
470 const char* next_slash = p;
471 while (*next_slash != '\0' && *next_slash != '/' && *next_slash != '\\') {
472 ++next_slash;
473 }
474
475 bool is_src = Common::ComparePartialString(p, next_slash, root);
476 p = next_slash;
477
478 if (*p != '\0') {
479 ++p;
480 }
481 if (is_src) {
482 path = p;
483 }
484 }
485 return path;
486}
487
465} // namespace Common 488} // namespace Common