Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
e9d42e05
Commit
e9d42e05
authored
Oct 25, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// support forward slash in windows
parent
a8f72424
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
include/spdlog/details/os-inl.h
include/spdlog/details/os-inl.h
+7
-11
include/spdlog/details/os.h
include/spdlog/details/os.h
+1
-1
No files found.
include/spdlog/details/os-inl.h
View file @
e9d42e05
...
@@ -488,14 +488,13 @@ SPDLOG_INLINE bool create_dir(filename_t path)
...
@@ -488,14 +488,13 @@ SPDLOG_INLINE bool create_dir(filename_t path)
using
char_type
=
filename_t
::
value_type
;
using
char_type
=
filename_t
::
value_type
;
std
::
basic_istringstream
<
char_type
>
istream
(
path
);
std
::
basic_istringstream
<
char_type
>
istream
(
path
);
filename_t
token
;
filename_t
token
;
filename_t
cur_dir
;
filename_t
cur_dir
;
char_type
sep
=
'/'
;
#ifdef _WIN32
#ifdef _WIN32
// support forward slash in windows
// support forward slash in windows
std
::
replace
(
path
.
begin
(),
path
.
end
(),
char_type
(
'\\'
),
sep
);
std
::
replace
(
path
.
begin
(),
path
.
end
(),
'/'
,
folder_
sep
);
#endif
#endif
while
(
std
::
getline
(
istream
,
token
,
sep
))
while
(
std
::
getline
(
istream
,
token
,
folder_
sep
))
{
{
if
(
!
token
.
empty
())
if
(
!
token
.
empty
())
{
{
...
@@ -505,7 +504,7 @@ SPDLOG_INLINE bool create_dir(filename_t path)
...
@@ -505,7 +504,7 @@ SPDLOG_INLINE bool create_dir(filename_t path)
return
false
;
return
false
;
}
}
}
}
cur_dir
+=
sep
;
cur_dir
+=
folder_
sep
;
}
}
return
true
;
return
true
;
...
@@ -517,15 +516,12 @@ SPDLOG_INLINE bool create_dir(filename_t path)
...
@@ -517,15 +516,12 @@ SPDLOG_INLINE bool create_dir(filename_t path)
// "abc" => ""
// "abc" => ""
// "abc///" => "abc//"
// "abc///" => "abc//"
SPDLOG_INLINE
filename_t
dir_name
(
filename_t
path
)
SPDLOG_INLINE
filename_t
dir_name
(
filename_t
path
)
{
{
using
char_type
=
filename_t
::
value_type
;
char_type
sep
=
'/'
;
#ifdef _WIN32
#ifdef _WIN32
// support forward slash in windows
// support forward slash in windows
std
::
replace
(
path
.
begin
(),
path
.
end
(),
char_type
(
'\\'
),
sep
);
std
::
replace
(
path
.
begin
(),
path
.
end
(),
'/'
,
folder_
sep
);
#endif
#endif
auto
pos
=
path
.
find_last_of
(
sep
);
auto
pos
=
path
.
find_last_of
(
folder_
sep
);
return
pos
!=
filename_t
::
npos
?
path
.
substr
(
0
,
pos
)
:
filename_t
{};
return
pos
!=
filename_t
::
npos
?
path
.
substr
(
0
,
pos
)
:
filename_t
{};
}
}
...
...
include/spdlog/details/os.h
View file @
e9d42e05
...
@@ -33,7 +33,7 @@ SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
...
@@ -33,7 +33,7 @@ SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
// folder separator
// folder separator
#ifdef _WIN32
#ifdef _WIN32
const
char
folder_sep
=
'\\'
;
static
const
char
folder_sep
=
'\\'
;
#else
#else
SPDLOG_CONSTEXPR
static
const
char
folder_sep
=
'/'
;
SPDLOG_CONSTEXPR
static
const
char
folder_sep
=
'/'
;
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment