diff options
| author | 2018-04-02 21:19:20 -0400 | |
|---|---|---|
| committer | 2018-04-02 21:19:20 -0400 | |
| commit | c2e0820ac2c0b51c0b14af608f4225eec8712f5e (patch) | |
| tree | 0a40b6f36c98402748b881fb43986f32d16ffbd8 /src/common/string_util.cpp | |
| parent | Merge pull request #267 from N00byKing/patch-1 (diff) | |
| parent | Remove dependency chrono (diff) | |
| download | yuzu-c2e0820ac2c0b51c0b14af608f4225eec8712f5e.tar.gz yuzu-c2e0820ac2c0b51c0b14af608f4225eec8712f5e.tar.xz yuzu-c2e0820ac2c0b51c0b14af608f4225eec8712f5e.zip | |
Merge pull request #262 from daniellimws/fmtlib-macros
Logging: Add fmtlib-based macros
Diffstat (limited to 'src/common/string_util.cpp')
| -rw-r--r-- | src/common/string_util.cpp | 23 |
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 | |||
| 466 | const 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 |