Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
4dd861ee
Commit
4dd861ee
authored
Feb 27, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/FileSystem: merge CheckAccess() into PathExists()
PathExists() should better do what CheckAccess() does, and CheckAccess() doesn't do what its name implies.
parent
4f0f81a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
17 deletions
+7
-17
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+1
-1
FileSystem.hxx
src/fs/FileSystem.hxx
+6
-16
No files found.
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
4dd861ee
...
...
@@ -117,7 +117,7 @@ SimpleDatabase::Check(Error &error) const
assert
(
!
path
.
IsNull
());
/* Check if the file exists */
if
(
!
CheckAcces
s
(
path
))
{
if
(
!
PathExist
s
(
path
))
{
/* If the file doesn't exist, we can't check if we can write
* it, so we are going to try to get the directory path, and
* see if we can write a file in that */
...
...
src/fs/FileSystem.hxx
View file @
4dd861ee
...
...
@@ -123,20 +123,6 @@ CheckAccess(Path path, int mode)
#endif
/**
* Checks is specified path exists and accessible.
*/
static
inline
bool
CheckAccess
(
Path
path
)
{
#ifdef WIN32
struct
stat
buf
;
return
StatFile
(
path
,
buf
);
#else
return
CheckAccess
(
path
,
F_OK
);
#endif
}
/**
* Checks if #Path exists and is a regular file.
*/
static
inline
bool
...
...
@@ -160,10 +146,14 @@ DirectoryExists(Path path, bool follow_symlinks = true)
* Checks if #Path exists.
*/
static
inline
bool
PathExists
(
Path
path
,
bool
follow_symlinks
=
true
)
PathExists
(
Path
path
)
{
#ifdef WIN32
struct
stat
buf
;
return
StatFile
(
path
,
buf
,
follow_symlinks
);
return
StatFile
(
path
,
buf
);
#else
return
CheckAccess
(
path
,
F_OK
);
#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