MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / RemoveExtension

Method RemoveExtension

test/common/gtest/gtest.cpp:8394–8401  ·  view source on GitHub ↗

Returns a copy of the FilePath with the case-insensitive extension removed. Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns FilePath("dir/file"). If a case-insensitive extension is not found, returns a copy of the original FilePath.

Source from the content-addressed store, hash-verified

8392// FilePath("dir/file"). If a case-insensitive extension is not
8393// found, returns a copy of the original FilePath.
8394FilePath FilePath::RemoveExtension(const char* extension) const {
8395 const std::string dot_extension = std::string(".") + extension;
8396 if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) {
8397 return FilePath(pathname_.substr(
8398 0, pathname_.length() - dot_extension.length()));
8399 }
8400 return *this;
8401}
8402
8403// Returns a pointer to the last occurence of a valid path separator in
8404// the FilePath. On Windows, for example, both '/' and '\' are valid path

Callers 1

GetCurrentExecutableNameFunction · 0.80

Calls 1

FilePathFunction · 0.85

Tested by

no test coverage detected