MCPcopy Create free account
hub / github.com/dobin/RedEdr / suggest_log_path

Function suggest_log_path

RedEdrShared/loguru.cpp:737–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735 }
736
737 void suggest_log_path(const char* prefix, char* buff, unsigned long long buff_size)
738 {
739 if (prefix[0] == '~') {
740 snprintf(buff, buff_size - 1, "%s%s", home_dir(), prefix + 1);
741 }
742 else {
743 snprintf(buff, buff_size - 1, "%s", prefix);
744 }
745
746 // Check for terminating /
747 size_t n = strlen(buff);
748 if (n != 0) {
749 if (buff[n - 1] != '/') {
750 CHECK_F(n + 2 < buff_size, "Filename buffer too small");
751 buff[n] = '/';
752 buff[n + 1] = '\0';
753 }
754 }
755
756#ifdef _WIN32
757 strncat_s(buff, buff_size - strlen(buff) - 1, s_argv0_filename.c_str(), buff_size - strlen(buff) - 1);
758 strncat_s(buff, buff_size - strlen(buff) - 1, "/", buff_size - strlen(buff) - 1);
759 write_date_time(buff + strlen(buff), buff_size - strlen(buff));
760 strncat_s(buff, buff_size - strlen(buff) - 1, ".log", buff_size - strlen(buff) - 1);
761#else
762 strncat(buff, s_argv0_filename.c_str(), buff_size - strlen(buff) - 1);
763 strncat(buff, "/", buff_size - strlen(buff) - 1);
764 write_date_time(buff + strlen(buff), buff_size - strlen(buff));
765 strncat(buff, ".log", buff_size - strlen(buff) - 1);
766#endif
767 }
768
769 bool create_directories(const char* file_path_const)
770 {

Callers

nothing calls this directly

Calls 2

home_dirFunction · 0.85
write_date_timeFunction · 0.85

Tested by

no test coverage detected