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
09f743dc
Commit
09f743dc
authored
Jul 18, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config/File: add directive "include_optional"
parent
035f986a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
user.xml
doc/user.xml
+8
-0
File.cxx
src/config/File.cxx
+9
-1
No files found.
doc/user.xml
View file @
09f743dc
...
...
@@ -418,6 +418,14 @@ systemctl start mpd.socket</programlisting>
</para>
<programlisting>
include "other.conf"
</programlisting>
<para>
You can use
<varname>
include_optional
</varname>
instead if you
want the included file to be optional; the directive will be
ignored if the file does not exist:
</para>
<programlisting>
include_optional "may_not_exist.conf"
</programlisting>
</section>
<section
id=
"config_music_directory"
>
...
...
src/config/File.cxx
View file @
09f743dc
...
...
@@ -28,6 +28,7 @@
#include "util/StringAPI.hxx"
#include "util/Domain.hxx"
#include "util/RuntimeError.hxx"
#include "fs/FileSystem.hxx"
#include "fs/Path.hxx"
#include "fs/io/FileReader.hxx"
#include "fs/io/BufferedReader.hxx"
...
...
@@ -179,13 +180,20 @@ ReadConfigFile(ConfigData &config_data, BufferedReader &reader, Path directory)
// TODO: detect recursion
// TODO: Config{Block,Param} have only line number but no file name
// TODO: support wildcards (include "conf.d/*.conf")
// TODO: add "include_optional"
const
auto
path
=
AllocatedPath
::
Apply
(
directory
,
AllocatedPath
::
FromUTF8Throw
(
ExpectValueAndEnd
(
tokenizer
)));
ReadConfigFile
(
config_data
,
path
);
continue
;
}
if
(
StringIsEqual
(
name
,
"include_optional"
))
{
const
auto
path
=
AllocatedPath
::
Apply
(
directory
,
AllocatedPath
::
FromUTF8Throw
(
ExpectValueAndEnd
(
tokenizer
)));
if
(
PathExists
(
path
))
ReadConfigFile
(
config_data
,
path
);
continue
;
}
/* get the definition of that option, and check the
"repeatable" flag */
...
...
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