Skip to content

Commit 51372b8

Browse files
committed
Some preparations for meshes/particlesPath
1 parent e872730 commit 51372b8

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/Series.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,24 @@ Series &Series::setBasePath(std::string const &bp)
156156

157157
std::string Series::meshesPath() const
158158
{
159-
return getAttribute("meshesPath").get<std::string>();
159+
auto res = meshesPaths();
160+
if (res.empty())
161+
{
162+
throw no_such_attribute_error("meshesPath");
163+
}
164+
/*
165+
* @todo: Verify that meshesPath has canonical form
166+
*/
167+
return res.at(0);
160168
}
161169

162170
std::vector<std::string> Series::meshesPaths() const
163171
{
164-
try
172+
if (containsAttribute("meshesPath"))
165173
{
166174
return getAttribute("meshesPath").get<std::vector<std::string>>();
167175
}
168-
catch (no_such_attribute_error const &)
176+
else
169177
{
170178
return {};
171179
}
@@ -211,16 +219,24 @@ Series &Series::setMeshesPath(std::vector<std::string> const &mp)
211219

212220
std::string Series::particlesPath() const
213221
{
214-
return getAttribute("particlesPath").get<std::string>();
222+
auto res = particlesPaths();
223+
if (res.empty())
224+
{
225+
throw no_such_attribute_error("particlesPath");
226+
}
227+
/*
228+
* @todo: Verify that particlesPath has canonical form
229+
*/
230+
return res.at(0);
215231
}
216232

217233
std::vector<std::string> Series::particlesPaths() const
218234
{
219-
try
235+
if (containsAttribute("particlesPath"))
220236
{
221237
return getAttribute("particlesPath").get<std::vector<std::string>>();
222238
}
223-
catch (no_such_attribute_error const &)
239+
else
224240
{
225241
return {};
226242
}

0 commit comments

Comments
 (0)