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
9b5bae04
Commit
9b5bae04
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config/Param: overload GetPath() throwing exception
parent
7a341516
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
Param.cxx
src/config/Param.cxx
+14
-0
Param.hxx
src/config/Param.hxx
+9
-0
No files found.
src/config/Param.cxx
View file @
9b5bae04
...
...
@@ -23,6 +23,8 @@
#include "fs/AllocatedPath.hxx"
#include "util/Error.hxx"
#include <stdexcept>
ConfigParam
::
ConfigParam
(
const
char
*
_value
,
int
_line
)
:
next
(
nullptr
),
value
(
_value
),
line
(
_line
),
used
(
false
)
{}
...
...
@@ -41,3 +43,15 @@ ConfigParam::GetPath(Error &error) const
return
path
;
}
AllocatedPath
ConfigParam
::
GetPath
()
const
{
Error
error
;
auto
path
=
ParsePath
(
value
.
c_str
(),
error
);
if
(
gcc_unlikely
(
path
.
IsNull
()))
throw
std
::
runtime_error
(
error
.
GetMessage
());
return
path
;
}
This diff is collapsed.
Click to expand it.
src/config/Param.hxx
View file @
9b5bae04
...
...
@@ -72,6 +72,15 @@ struct ConfigParam {
* AllocatedPath::Null() and sets the error.
*/
AllocatedPath
GetPath
(
Error
&
error
)
const
;
/**
* Parse the value as a path. If there is a tilde prefix, it
* is expanded.
*
* Throws #std::runtime_error on error.
*/
gcc_pure
AllocatedPath
GetPath
()
const
;
};
#endif
This diff is collapsed.
Click to expand it.
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