File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ namespace string_tools
212
212
// ----------------------------------------------------------------------------
213
213
std::string cut_off_extension (const std::string& str)
214
214
{
215
- return boost::filesystem::path (str).stem ( ).string ();
215
+ return boost::filesystem::path (str).replace_extension ( " " ).string ();
216
216
}
217
217
218
218
#ifdef _WIN32
Original file line number Diff line number Diff line change @@ -1435,6 +1435,13 @@ TEST(StringTools, GetExtension)
1435
1435
EXPECT_EQ (std::string{" 3" }, epee::string_tools::get_extension (" 1.2.3" ));
1436
1436
}
1437
1437
1438
+ TEST (StringTools, CutOffExtension)
1439
+ {
1440
+ EXPECT_EQ (std::string{}, epee::string_tools::cut_off_extension (" " ));
1441
+ EXPECT_EQ (std::string{" /home/user/Monero/wallets/wallet" }, epee::string_tools::cut_off_extension (" /home/user/Monero/wallets/wallet" ));
1442
+ EXPECT_EQ (std::string{" /home/user/Monero/wallets/wallet" }, epee::string_tools::cut_off_extension (" /home/user/Monero/wallets/wallet.keys" ));
1443
+ }
1444
+
1438
1445
TEST (NetUtils, IPv4NetworkAddress)
1439
1446
{
1440
1447
static_assert (epee::net_utils::ipv4_network_address::get_type_id () == epee::net_utils::address_type::ipv4, " bad ipv4 type id" );
You can’t perform that action at this time.
0 commit comments