remove Common::TrimSourcePath
wwylele / 白疾風Today at 6:14 PM I doubt the performance of constructing regex everytime the function is called Is TrimSourcePath only called by logging? if so, you can move the implementation into logging, and cache the regex object into global This function is probably too specific to be in common anyway
This commit is contained in:
parent
605dfe80e7
commit
36e368ff99
3 changed files with 4 additions and 28 deletions
|
@ -64,16 +64,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) {
|
|||
*/
|
||||
std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len);
|
||||
|
||||
/**
|
||||
* Attempts to trim an arbitrary prefix from `path`, leaving only the part starting at `root`. It's
|
||||
* intended to be used to strip a system-specific build directory from the `__FILE__` macro,
|
||||
* leaving only the path relative to the sources root.
|
||||
*
|
||||
* @param path The input file path as a string
|
||||
* @param roots The name of the root source directorys as a vector of strings. Path up to and
|
||||
* including the last occurrence of these names will be stripped
|
||||
* @return The trimmed path as a string
|
||||
*/
|
||||
std::string TrimSourcePath(const std::string& file_path, const std::vector<std::string>& roots);
|
||||
|
||||
} // namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue