Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
0c60107e
Commit
0c60107e
authored
Oct 25, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoed file_helper
parent
49eb9cbd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
file_helper-inl.h
include/spdlog/details/file_helper-inl.h
+4
-5
os-inl.h
include/spdlog/details/os-inl.h
+1
-0
No files found.
include/spdlog/details/file_helper-inl.h
View file @
0c60107e
...
...
@@ -28,15 +28,14 @@ SPDLOG_INLINE file_helper::~file_helper()
SPDLOG_INLINE
void
file_helper
::
open
(
const
filename_t
&
fname
,
bool
truncate
)
{
close
();
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
auto
folder_name
=
os
::
dir_name
(
fname
);
filename_
=
fname
;
// create containing folder if not empty string and not exists already
os
::
create_dir
(
os
::
dir_name
(
fname
));
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
for
(
int
tries
=
0
;
tries
<
open_tries_
;
++
tries
)
{
// create if not empty and not exists already
os
::
create_dir
(
folder_name
);
if
(
!
os
::
fopen_s
(
&
fd_
,
fname
,
mode
))
{
return
;
...
...
include/spdlog/details/os-inl.h
View file @
0c60107e
...
...
@@ -499,6 +499,7 @@ SPDLOG_INLINE bool create_dir(filename_t path)
size_t
search_offset
=
0
;
do
{
fmt
::
string_view
t
;
auto
token_pos
=
path
.
find
(
folder_sep
,
search_offset
);
// treat the entire path as a folder if no folder separator not found
if
(
token_pos
==
filename_t
::
npos
)
...
...
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