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
9bef46c0
Commit
9bef46c0
authored
Jul 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mapper: use g_file_test() instead of stat()
The GLib functions are more portable.
parent
c134adbc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
20 deletions
+2
-20
mapper.c
src/mapper.c
+2
-20
No files found.
src/mapper.c
View file @
9bef46c0
...
@@ -29,11 +29,7 @@
...
@@ -29,11 +29,7 @@
#include <glib.h>
#include <glib.h>
#include <assert.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <string.h>
#include <errno.h>
static
char
*
music_dir
;
static
char
*
music_dir
;
static
size_t
music_dir_length
;
static
size_t
music_dir_length
;
...
@@ -57,17 +53,10 @@ strdup_chop_slash(const char *path_fs)
...
@@ -57,17 +53,10 @@ strdup_chop_slash(const char *path_fs)
static
void
static
void
mapper_set_music_dir
(
const
char
*
path
)
mapper_set_music_dir
(
const
char
*
path
)
{
{
int
ret
;
struct
stat
st
;
music_dir
=
strdup_chop_slash
(
path
);
music_dir
=
strdup_chop_slash
(
path
);
music_dir_length
=
strlen
(
music_dir
);
music_dir_length
=
strlen
(
music_dir
);
ret
=
stat
(
music_dir
,
&
st
);
if
(
!
g_file_test
(
music_dir
,
G_FILE_TEST_IS_DIR
))
if
(
ret
<
0
)
g_warning
(
"failed to stat music directory
\"
%s
\"
: %s"
,
music_dir
,
g_strerror
(
errno
));
else
if
(
!
S_ISDIR
(
st
.
st_mode
))
g_warning
(
"music directory is not a directory:
\"
%s
\"
"
,
g_warning
(
"music directory is not a directory:
\"
%s
\"
"
,
music_dir
);
music_dir
);
}
}
...
@@ -75,16 +64,9 @@ mapper_set_music_dir(const char *path)
...
@@ -75,16 +64,9 @@ mapper_set_music_dir(const char *path)
static
void
static
void
mapper_set_playlist_dir
(
const
char
*
path
)
mapper_set_playlist_dir
(
const
char
*
path
)
{
{
int
ret
;
struct
stat
st
;
playlist_dir
=
g_strdup
(
path
);
playlist_dir
=
g_strdup
(
path
);
ret
=
stat
(
playlist_dir
,
&
st
);
if
(
!
g_file_test
(
playlist_dir
,
G_FILE_TEST_IS_DIR
))
if
(
ret
<
0
)
g_warning
(
"failed to stat playlist directory
\"
%s
\"
: %s"
,
playlist_dir
,
g_strerror
(
errno
));
else
if
(
!
S_ISDIR
(
st
.
st_mode
))
g_warning
(
"playlist directory is not a directory:
\"
%s
\"
"
,
g_warning
(
"playlist directory is not a directory:
\"
%s
\"
"
,
playlist_dir
);
playlist_dir
);
}
}
...
...
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