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
99526219
Commit
99526219
authored
Feb 02, 2013
by
Denis Krjuchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UpdateIO.cxx: use file system API, log in UTF-8
parent
d818b618
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
UpdateIO.cxx
src/UpdateIO.cxx
+17
-12
No files found.
src/UpdateIO.cxx
View file @
99526219
...
@@ -36,12 +36,15 @@ stat_directory(const Directory *directory, struct stat *st)
...
@@ -36,12 +36,15 @@ stat_directory(const Directory *directory, struct stat *st)
if
(
path_fs
.
IsNull
())
if
(
path_fs
.
IsNull
())
return
-
1
;
return
-
1
;
int
ret
=
stat
(
path_fs
.
c_str
(),
st
);
if
(
!
StatFile
(
path_fs
,
*
st
))
{
if
(
ret
<
0
)
int
error
=
errno
;
const
std
::
string
path_utf8
=
path_fs
.
ToUTF8
();
g_warning
(
"Failed to stat %s: %s"
,
g_warning
(
"Failed to stat %s: %s"
,
path_fs
.
c_str
(),
g_strerror
(
errno
));
path_utf8
.
c_str
(),
g_strerror
(
error
));
return
-
1
;
}
return
ret
;
return
0
;
}
}
int
int
...
@@ -52,12 +55,15 @@ stat_directory_child(const Directory *parent, const char *name,
...
@@ -52,12 +55,15 @@ stat_directory_child(const Directory *parent, const char *name,
if
(
path_fs
.
IsNull
())
if
(
path_fs
.
IsNull
())
return
-
1
;
return
-
1
;
int
ret
=
stat
(
path_fs
.
c_str
(),
st
);
if
(
!
StatFile
(
path_fs
,
*
st
))
{
if
(
ret
<
0
)
int
error
=
errno
;
const
std
::
string
path_utf8
=
path_fs
.
ToUTF8
();
g_warning
(
"Failed to stat %s: %s"
,
g_warning
(
"Failed to stat %s: %s"
,
path_fs
.
c_str
(),
g_strerror
(
errno
));
path_utf8
.
c_str
(),
g_strerror
(
error
));
return
-
1
;
}
return
ret
;
return
0
;
}
}
bool
bool
...
@@ -82,8 +88,7 @@ directory_child_is_regular(const Directory *directory,
...
@@ -82,8 +88,7 @@ directory_child_is_regular(const Directory *directory,
if
(
path_fs
.
IsNull
())
if
(
path_fs
.
IsNull
())
return
false
;
return
false
;
struct
stat
st
;
return
FileExists
(
path_fs
);
return
stat
(
path_fs
.
c_str
(),
&
st
)
==
0
&&
S_ISREG
(
st
.
st_mode
);
}
}
bool
bool
...
@@ -91,7 +96,7 @@ directory_child_access(const Directory *directory,
...
@@ -91,7 +96,7 @@ directory_child_access(const Directory *directory,
const
char
*
name
,
int
mode
)
const
char
*
name
,
int
mode
)
{
{
#ifdef WIN32
#ifdef WIN32
/*
a
ccess() is useless on WIN32 */
/*
CheckA
ccess() is useless on WIN32 */
(
void
)
directory
;
(
void
)
directory
;
(
void
)
name
;
(
void
)
name
;
(
void
)
mode
;
(
void
)
mode
;
...
@@ -103,6 +108,6 @@ directory_child_access(const Directory *directory,
...
@@ -103,6 +108,6 @@ directory_child_access(const Directory *directory,
problem */
problem */
return
true
;
return
true
;
return
access
(
path
.
c_str
(),
mode
)
==
0
||
errno
!=
EACCES
;
return
CheckAccess
(
path
,
mode
)
||
errno
!=
EACCES
;
#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