Fix typo in file_helper.h

* "extenstion" -> "extension"
This commit is contained in:
Ben Ridder 2019-01-08 10:09:11 -08:00
parent 0203a0fdaf
commit fb702f989f
4 changed files with 5 additions and 5 deletions

View File

@ -122,7 +122,7 @@ public:
// ".mylog" => (".mylog". "") // ".mylog" => (".mylog". "")
// "my_folder/.mylog" => ("my_folder/.mylog", "") // "my_folder/.mylog" => ("my_folder/.mylog", "")
// "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") // "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('.'); auto ext_index = fname.rfind('.');

View File

@ -32,7 +32,7 @@ struct daily_filename_calculator
static filename_t calc_filename(const filename_t &filename, const tm &now_tm) static filename_t calc_filename(const filename_t &filename, const tm &now_tm)
{ {
filename_t basename, ext; 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; std::conditional<std::is_same<filename_t::value_type, char>::value, fmt::memory_buffer, fmt::wmemory_buffer>::type w;
fmt::format_to( 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); w, SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}"), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday, ext);

View File

@ -48,7 +48,7 @@ public:
if (index != 0u) if (index != 0u)
{ {
filename_t basename, ext; 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); fmt::format_to(w, SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
} }
else else

View File

@ -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(), '/', '\\'); std::replace(expected_base.begin(), expected_base.end(), '/', '\\');
#endif #endif
spdlog::filename_t basename, ext; 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(basename == expected_base);
REQUIRE(ext == expected_ext); 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");
test_split_ext(".mylog.txt", ".mylog", ".txt"); test_split_ext(".mylog.txt", ".mylog", ".txt");