mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-22 12:30:04 +00:00
chore: De-duplicate code for parse(std::filesystem::path)
This commit is contained in:
parent
bf9c9d620d
commit
021d84623c
@ -2516,13 +2516,7 @@ template<typename Comment = TOML11_DEFAULT_COMMENT_STRATEGY,
|
|||||||
template<typename ...> class Array = std::vector>
|
template<typename ...> class Array = std::vector>
|
||||||
basic_value<Comment, Table, Array> parse(const std::filesystem::path& fpath)
|
basic_value<Comment, Table, Array> parse(const std::filesystem::path& fpath)
|
||||||
{
|
{
|
||||||
std::ifstream ifs(fpath, std::ios_base::binary);
|
return parse<Comment, Table, Array>(fpath.string());
|
||||||
if(!ifs.good())
|
|
||||||
{
|
|
||||||
throw std::runtime_error("toml::parse: file open error -> " +
|
|
||||||
fpath.string());
|
|
||||||
}
|
|
||||||
return parse<Comment, Table, Array>(ifs, fpath.string());
|
|
||||||
}
|
}
|
||||||
#endif // TOML11_HAS_STD_FILESYSTEM
|
#endif // TOML11_HAS_STD_FILESYSTEM
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user