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
89457365
Commit
89457365
authored
May 20, 2010
by
Avuton Olrich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdline: Add default config paths for win32.
parent
9cce1d74
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
1 deletion
+38
-1
cmdline.c
src/cmdline.c
+38
-1
No files found.
src/cmdline.c
View file @
89457365
...
...
@@ -40,8 +40,12 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef G_OS_WIN32
#define CONFIG_FILE_LOCATION "\\mpd\\mpd.conf"
#else
/* G_OS_WIN32 */
#define USER_CONFIG_FILE_LOCATION1 ".mpdconf"
#define USER_CONFIG_FILE_LOCATION2 ".mpd/mpd.conf"
#endif
static
GQuark
cmdline_quark
(
void
)
...
...
@@ -171,8 +175,37 @@ parse_cmdline(int argc, char **argv, struct options *options,
}
else
if
(
argc
<=
1
)
{
/* default configuration file path */
char
*
path1
;
char
*
path2
;
#ifdef G_OS_WIN32
path1
=
g_build_filename
(
g_get_user_config_dir
(),
CONFIG_FILE_LOCATION
,
NULL
);
if
(
g_file_test
(
path1
,
G_FILE_TEST_IS_REGULAR
))
ret
=
config_read_file
(
path1
,
error_r
);
else
{
int
i
=
0
;
char
*
system_path
=
NULL
;
const
char
*
const
*
system_config_dirs
;
system_config_dirs
=
g_get_system_config_dirs
();
while
(
system_config_dirs
[
i
]
!=
NULL
)
{
system_path
=
g_build_filename
(
system_config_dirs
[
i
],
CONFIG_FILE_LOCATION
,
NULL
);
if
(
g_file_test
(
system_path
,
G_FILE_TEST_IS_REGULAR
))
{
ret
=
config_read_file
(
system_path
,
error_r
);
g_free
(
system_path
);
g_free
(
&
system_config_dirs
);
break
;
}
++
i
;;
}
g_free
(
system_path
);
g_free
(
&
system_config_dirs
);
}
#else
/* G_OS_WIN32 */
char
*
path2
;
path1
=
g_build_filename
(
g_get_home_dir
(),
USER_CONFIG_FILE_LOCATION1
,
NULL
);
path2
=
g_build_filename
(
g_get_home_dir
(),
...
...
@@ -185,8 +218,12 @@ parse_cmdline(int argc, char **argv, struct options *options,
G_FILE_TEST_IS_REGULAR
))
ret
=
config_read_file
(
SYSTEM_CONFIG_FILE_LOCATION
,
error_r
);
#endif
g_free
(
path1
);
#ifndef G_OS_WIN32
g_free
(
path2
);
#endif
return
ret
;
}
else
if
(
argc
==
2
)
{
...
...
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