Skip to content

Commit 8948493

Browse files
authored
Search for \ if under msvc (#236)
1 parent 6254580 commit 8948493

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

trantor/utils/Logger.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ class TRANTOR_EXPORT Logger : public NonCopyable
5656
inline SourceFile(const char (&arr)[N]) : data_(arr), size_(N - 1)
5757
{
5858
// std::cout<<data_<<std::endl;
59+
#ifndef _MSC_VER
5960
const char *slash = strrchr(data_, '/'); // builtin function
61+
#else
62+
const char *slash = strrchr(data_, '\\');
63+
#endif
6064
if (slash)
6165
{
6266
data_ = slash + 1;
@@ -66,7 +70,11 @@ class TRANTOR_EXPORT Logger : public NonCopyable
6670

6771
explicit SourceFile(const char *filename) : data_(filename)
6872
{
73+
#ifndef _MSC_VER
6974
const char *slash = strrchr(filename, '/');
75+
#else
76+
const char *slash = strrchr(filename, '\\');
77+
#endif
7078
if (slash)
7179
{
7280
data_ = slash + 1;

0 commit comments

Comments
 (0)