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 @@ -189,7 +189,7 @@ namespace string_tools
189
189
// ----------------------------------------------------------------------------
190
190
std::string cut_off_extension (const std::string& str)
191
191
{
192
- return boost::filesystem::path (str).stem ( ).string ();
192
+ return boost::filesystem::path (str).replace_extension ( " " ).string ();
193
193
}
194
194
195
195
#ifdef _WIN32
Original file line number Diff line number Diff line change @@ -1451,6 +1451,13 @@ TEST(StringTools, GetExtension)
1451
1451
EXPECT_EQ (std::string{" 3" }, epee::string_tools::get_extension (" 1.2.3" ));
1452
1452
}
1453
1453
1454
+ TEST (StringTools, CutOffExtension)
1455
+ {
1456
+ EXPECT_EQ (std::string{}, epee::string_tools::cut_off_extension (" " ));
1457
+ EXPECT_EQ (std::string{" /home/user/Monero/wallets/wallet" }, epee::string_tools::cut_off_extension (" /home/user/Monero/wallets/wallet" ));
1458
+ EXPECT_EQ (std::string{" /home/user/Monero/wallets/wallet" }, epee::string_tools::cut_off_extension (" /home/user/Monero/wallets/wallet.keys" ));
1459
+ }
1460
+
1454
1461
TEST (NetUtils, IPv4NetworkAddress)
1455
1462
{
1456
1463
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