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
37c4470f
Commit
37c4470f
authored
Nov 10, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/CheckFile: use FileInfo(Path) instead of GetFileInfo()
parent
4dc7d1c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
CheckFile.cxx
src/fs/CheckFile.cxx
+10
-11
No files found.
src/fs/CheckFile.cxx
View file @
37c4470f
...
...
@@ -31,27 +31,24 @@
void
CheckDirectoryReadable
(
Path
path_fs
)
{
Error
error
;
FileInfo
fi
;
if
(
!
GetFileInfo
(
path_fs
,
fi
,
error
))
{
LogError
(
error
);
return
;
}
try
{
const
auto
path_utf8
=
path_fs
.
ToUTF8
();
const
FileInfo
fi
(
path_fs
);
if
(
!
fi
.
IsDirectory
())
{
const
auto
path_utf8
=
path_fs
.
ToUTF8
();
FormatError
(
config_domain
,
"Not a directory: %s"
,
path_utf8
.
c_str
());
return
;
}
#ifndef WIN32
try
{
const
auto
x
=
AllocatedPath
::
Build
(
path_fs
,
PathTraitsFS
::
CURRENT_DIRECTORY
);
if
(
!
GetFileInfo
(
x
,
fi
)
&&
errno
==
EACCES
)
{
const
auto
path_utf8
=
path_fs
.
ToUTF8
();
const
FileInfo
fi2
(
x
);
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
e
.
code
().
category
()
==
std
::
system_category
()
&&
e
.
code
().
value
()
==
EACCES
)
FormatError
(
config_domain
,
"No permission to traverse (
\"
execute
\"
) directory: %s"
,
path_utf8
.
c_str
());
...
...
@@ -66,4 +63,6 @@ CheckDirectoryReadable(Path path_fs)
"No permission to read directory: %s"
,
path_fs
.
ToUTF8
().
c_str
());
}
}
catch
(
const
std
::
runtime_error
&
e
)
{
LogError
(
e
);
}
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