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
70c6cc33
Commit
70c6cc33
authored
Jan 18, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: removed parseConfigFilePath()
Use config_get_path() instead in mapper.c.
parent
a0603d88
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
46 deletions
+19
-46
conf.c
src/conf.c
+0
-23
conf.h
src/conf.h
+0
-3
mapper.c
src/mapper.c
+19
-20
No files found.
src/conf.c
View file @
70c6cc33
...
...
@@ -425,29 +425,6 @@ getBlockParam(struct config_param * param, const char *name)
return
ret
;
}
struct
config_param
*
parseConfigFilePath
(
const
char
*
name
,
int
force
)
{
struct
config_param
*
param
=
config_get_param
(
name
);
char
*
path
;
if
(
!
param
&&
force
)
g_error
(
"config parameter
\"
%s
\"
not found
\n
"
,
name
);
if
(
!
param
)
return
NULL
;
path
=
parsePath
(
param
->
value
);
if
(
!
path
)
g_error
(
"error parsing
\"
%s
\"
at line %i
\n
"
,
name
,
param
->
line
);
g_free
(
param
->
value
);
param
->
value
=
path
;
return
param
;
}
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
)
{
struct
config_param
*
param
=
config_get_param
(
name
);
...
...
src/conf.h
View file @
70c6cc33
...
...
@@ -112,9 +112,6 @@ config_get_path(const char *name);
struct
block_param
*
getBlockParam
(
struct
config_param
*
param
,
const
char
*
name
);
struct
config_param
*
parseConfigFilePath
(
const
char
*
name
,
int
force
);
bool
config_get_bool
(
const
char
*
name
,
bool
default_value
);
bool
...
...
src/mapper.c
View file @
70c6cc33
...
...
@@ -41,7 +41,7 @@ static size_t music_dir_length;
static
char
*
playlist_dir
;
static
void
mapper_set_music_dir
(
const
char
*
path
,
int
line
)
mapper_set_music_dir
(
const
char
*
path
)
{
int
ret
;
struct
stat
st
;
...
...
@@ -51,15 +51,15 @@ mapper_set_music_dir(const char *path, int line)
ret
=
stat
(
music_dir
,
&
st
);
if
(
ret
<
0
)
g_warning
(
"failed to stat music directory
\"
%s
\"
(config line %i): %s
\n
"
,
music_dir
,
line
,
g_strerror
(
errno
));
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
\"
(config line %i)
\n
"
,
music_dir
,
line
);
g_warning
(
"music directory is not a directory:
\"
%s
\"
"
,
music_dir
);
}
static
void
mapper_set_playlist_dir
(
const
char
*
path
,
int
line
)
mapper_set_playlist_dir
(
const
char
*
path
)
{
int
ret
;
struct
stat
st
;
...
...
@@ -68,32 +68,31 @@ mapper_set_playlist_dir(const char *path, int line)
ret
=
stat
(
playlist_dir
,
&
st
);
if
(
ret
<
0
)
g_warning
(
"failed to stat playlist directory
\"
%s
\"
(config line %i): %s
\n
"
,
playlist_dir
,
line
,
g_strerror
(
errno
));
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
\"
(config line %i)
\n
"
,
playlist_dir
,
line
);
g_warning
(
"playlist directory is not a directory:
\"
%s
\"
"
,
playlist_dir
);
}
void
mapper_init
(
void
)
{
struct
config_param
*
param
;
const
char
*
path
;
pa
ram
=
parseConfigFilePath
(
CONF_MUSIC_DIR
,
false
);
if
(
pa
ram
!=
NULL
)
mapper_set_music_dir
(
pa
ram
->
value
,
param
->
line
);
pa
th
=
config_get_path
(
CONF_MUSIC_DIR
);
if
(
pa
th
!=
NULL
)
mapper_set_music_dir
(
pa
th
);
#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 14)
else
{
const
char
*
path
=
g_get_user_special_dir
(
G_USER_DIRECTORY_MUSIC
);
path
=
g_get_user_special_dir
(
G_USER_DIRECTORY_MUSIC
);
if
(
path
!=
NULL
)
mapper_set_music_dir
(
path
,
-
1
);
mapper_set_music_dir
(
path
);
}
#endif
pa
ram
=
parseConfigFilePath
(
CONF_PLAYLIST_DIR
,
false
);
if
(
pa
ram
!=
NULL
)
mapper_set_playlist_dir
(
pa
ram
->
value
,
param
->
line
);
pa
th
=
config_get_path
(
CONF_PLAYLIST_DIR
);
if
(
pa
th
!=
NULL
)
mapper_set_playlist_dir
(
pa
th
);
}
void
mapper_finish
(
void
)
...
...
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