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
dbe5c17a
Commit
dbe5c17a
authored
Oct 25, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed file_exists()->path_exists()
parent
c40555c0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
23 deletions
+10
-23
file_helper-inl.h
include/spdlog/details/file_helper-inl.h
+0
-5
file_helper.h
include/spdlog/details/file_helper.h
+0
-1
os-inl.h
include/spdlog/details/os-inl.h
+5
-5
os.h
include/spdlog/details/os.h
+1
-1
rotating_file_sink-inl.h
include/spdlog/sinks/rotating_file_sink-inl.h
+2
-1
test_create_dir.cpp
tests/test_create_dir.cpp
+2
-2
test_file_helper.cpp
tests/test_file_helper.cpp
+0
-8
No files found.
include/spdlog/details/file_helper-inl.h
View file @
dbe5c17a
...
...
@@ -97,11 +97,6 @@ SPDLOG_INLINE const filename_t &file_helper::filename() const
return
_filename
;
}
SPDLOG_INLINE
bool
file_helper
::
file_exists
(
const
filename_t
&
fname
)
{
return
os
::
file_exists
(
fname
);
}
//
// return file path and its extension:
//
...
...
include/spdlog/details/file_helper.h
View file @
dbe5c17a
...
...
@@ -29,7 +29,6 @@ public:
void
write
(
const
memory_buf_t
&
buf
);
size_t
size
()
const
;
const
filename_t
&
filename
()
const
;
static
bool
file_exists
(
const
filename_t
&
fname
);
//
// return file path and its extension:
...
...
include/spdlog/details/os-inl.h
View file @
dbe5c17a
...
...
@@ -178,7 +178,7 @@ SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT
SPDLOG_INLINE
int
remove_if_exists
(
const
filename_t
&
filename
)
SPDLOG_NOEXCEPT
{
return
file
_exists
(
filename
)
?
remove
(
filename
)
:
0
;
return
path
_exists
(
filename
)
?
remove
(
filename
)
:
0
;
}
SPDLOG_INLINE
int
rename
(
const
filename_t
&
filename1
,
const
filename_t
&
filename2
)
SPDLOG_NOEXCEPT
...
...
@@ -190,8 +190,8 @@ SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename
#endif
}
// Return true if
file exists
SPDLOG_INLINE
bool
file
_exists
(
const
filename_t
&
filename
)
SPDLOG_NOEXCEPT
// Return true if
path exists (file or directory)
SPDLOG_INLINE
bool
path
_exists
(
const
filename_t
&
filename
)
SPDLOG_NOEXCEPT
{
#ifdef _WIN32
#ifdef SPDLOG_WCHAR_FILENAMES
...
...
@@ -481,7 +481,7 @@ SPDLOG_INLINE bool mkdir_(const filename_t &path)
// return true on success
SPDLOG_INLINE
bool
create_dir
(
filename_t
path
)
{
if
(
file
_exists
(
path
))
if
(
path
_exists
(
path
))
{
return
true
;
}
...
...
@@ -503,7 +503,7 @@ SPDLOG_INLINE bool create_dir(filename_t path)
auto
subdir
=
path
.
substr
(
0
,
token_pos
);
if
(
!
subdir
.
empty
()
&&
!
file
_exists
(
subdir
)
&&
!
mkdir_
(
subdir
))
if
(
!
subdir
.
empty
()
&&
!
path
_exists
(
subdir
)
&&
!
mkdir_
(
subdir
))
{
return
false
;
// return error if failed creating dir
}
...
...
include/spdlog/details/os.h
View file @
dbe5c17a
...
...
@@ -53,7 +53,7 @@ int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
int
rename
(
const
filename_t
&
filename1
,
const
filename_t
&
filename2
)
SPDLOG_NOEXCEPT
;
// Return if file exists.
bool
file
_exists
(
const
filename_t
&
filename
)
SPDLOG_NOEXCEPT
;
bool
path
_exists
(
const
filename_t
&
filename
)
SPDLOG_NOEXCEPT
;
// Return file size according to open FILE* object
size_t
filesize
(
FILE
*
f
);
...
...
include/spdlog/sinks/rotating_file_sink-inl.h
View file @
dbe5c17a
...
...
@@ -88,11 +88,12 @@ template<typename Mutex>
SPDLOG_INLINE
void
rotating_file_sink
<
Mutex
>::
rotate_
()
{
using
details
::
os
::
filename_to_str
;
using
details
::
os
::
path_exists
;
file_helper_
.
close
();
for
(
auto
i
=
max_files_
;
i
>
0
;
--
i
)
{
filename_t
src
=
calc_filename
(
base_filename_
,
i
-
1
);
if
(
!
details
::
file_helper
::
file
_exists
(
src
))
if
(
!
path
_exists
(
src
))
{
continue
;
}
...
...
tests/test_create_dir.cpp
View file @
dbe5c17a
...
...
@@ -4,13 +4,13 @@
#include "includes.h"
using
spdlog
::
details
::
os
::
create_dir
;
using
spdlog
::
details
::
os
::
file
_exists
;
using
spdlog
::
details
::
os
::
path
_exists
;
bool
try_create_dir
(
const
char
*
path
,
const
char
*
normalized_path
)
{
auto
rv
=
create_dir
(
path
);
REQUIRE
(
rv
==
true
);
return
file
_exists
(
normalized_path
);
return
path
_exists
(
normalized_path
);
}
TEST_CASE
(
"create_dir"
,
"[create_dir]"
)
...
...
tests/test_file_helper.cpp
View file @
dbe5c17a
...
...
@@ -38,14 +38,6 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]")
REQUIRE
(
get_filesize
(
target_filename
)
==
expected_size
);
}
TEST_CASE
(
"file_helper_exists"
,
"[file_helper::file_exists()]]"
)
{
prepare_logdir
();
REQUIRE
(
!
file_helper
::
file_exists
(
target_filename
));
file_helper
helper
;
helper
.
open
(
target_filename
);
REQUIRE
(
file_helper
::
file_exists
(
target_filename
));
}
TEST_CASE
(
"file_helper_reopen"
,
"[file_helper::reopen()]]"
)
{
...
...
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