aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/string_tools.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2024-08-14 14:19:55 -0400
committerluigi1111 <luigi1111w@gmail.com>2024-08-14 14:19:55 -0400
commitb089f9ee69924882c5d14dd1a6991deb05d9d1cd (patch)
treed301e2f9fd084d7b870aaacb2072fc5227ddbc3f /contrib/epee/src/string_tools.cpp
parentc6d17a0b3938270b997f199e19ab47d4c2b41a83 (diff)
parent7cb69fa6bc668e6a4b485f7e192007d5ac84a44c (diff)
downloadmonzero-core-b089f9ee69924882c5d14dd1a6991deb05d9d1cd.tar.gz
monzero-core-b089f9ee69924882c5d14dd1a6991deb05d9d1cd.tar.xz
monzero-core-b089f9ee69924882c5d14dd1a6991deb05d9d1cd.zip
Merge pull request #9434v0.18.3.4
7cb69fa epee: string_tools: keep full path in cut_off_extension (tobtoht) c7d4bf4 epee: string_tools: remove dot from get_extension (tobtoht)
Diffstat (limited to 'contrib/epee/src/string_tools.cpp')
-rw-r--r--contrib/epee/src/string_tools.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/epee/src/string_tools.cpp b/contrib/epee/src/string_tools.cpp
index 4458dabdd..43f7aca9d 100644
--- a/contrib/epee/src/string_tools.cpp
+++ b/contrib/epee/src/string_tools.cpp
@@ -201,13 +201,18 @@ namespace string_tools
std::string get_extension(const std::string& str)
{
- return boost::filesystem::path(str).extension().string();
+ std::string ext_with_dot = boost::filesystem::path(str).extension().string();
+
+ if (ext_with_dot.empty())
+ return {};
+
+ return ext_with_dot.erase(0, 1);
}
//----------------------------------------------------------------------------
std::string cut_off_extension(const std::string& str)
{
- return boost::filesystem::path(str).stem().string();
+ return boost::filesystem::path(str).replace_extension("").string();
}
#ifdef _WIN32