mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +08:00
Merge pull request #955 from brridder/fix-typo
Fix typo in file_helper.h
This commit is contained in:
commit
5b273a33b4
@ -122,7 +122,7 @@ public:
|
||||
// ".mylog" => (".mylog". "")
|
||||
// "my_folder/.mylog" => ("my_folder/.mylog", "")
|
||||
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt")
|
||||
static std::tuple<filename_t, filename_t> split_by_extenstion(const spdlog::filename_t &fname)
|
||||
static std::tuple<filename_t, filename_t> split_by_extension(const spdlog::filename_t &fname)
|
||||
{
|
||||
auto ext_index = fname.rfind('.');
|
||||
|
||||
|
@ -32,7 +32,7 @@ struct daily_filename_calculator
|
||||
static filename_t calc_filename(const filename_t &filename, const tm &now_tm)
|
||||
{
|
||||
filename_t basename, ext;
|
||||
std::tie(basename, ext) = details::file_helper::split_by_extenstion(filename);
|
||||
std::tie(basename, ext) = details::file_helper::split_by_extension(filename);
|
||||
std::conditional<std::is_same<filename_t::value_type, char>::value, fmt::memory_buffer, fmt::wmemory_buffer>::type w;
|
||||
fmt::format_to(
|
||||
w, SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, ext);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
if (index != 0u)
|
||||
{
|
||||
filename_t basename, ext;
|
||||
std::tie(basename, ext) = details::file_helper::split_by_extenstion(filename);
|
||||
std::tie(basename, ext) = details::file_helper::split_by_extension(filename);
|
||||
fmt::format_to(w, SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
|
||||
}
|
||||
else
|
||||
|
@ -81,12 +81,12 @@ static void test_split_ext(const char *fname, const char *expect_base, const cha
|
||||
std::replace(expected_base.begin(), expected_base.end(), '/', '\\');
|
||||
#endif
|
||||
spdlog::filename_t basename, ext;
|
||||
std::tie(basename, ext) = file_helper::split_by_extenstion(filename);
|
||||
std::tie(basename, ext) = file_helper::split_by_extension(filename);
|
||||
REQUIRE(basename == expected_base);
|
||||
REQUIRE(ext == expected_ext);
|
||||
}
|
||||
|
||||
TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]")
|
||||
TEST_CASE("file_helper_split_by_extension", "[file_helper::split_by_extension()]]")
|
||||
{
|
||||
test_split_ext("mylog.txt", "mylog", ".txt");
|
||||
test_split_ext(".mylog.txt", ".mylog", ".txt");
|
||||
|
Loading…
Reference in New Issue
Block a user