Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
ce14593f
Unverified
Commit
ce14593f
authored
May 31, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved loading resources from absolute path
better error reporting when loading dictionary
parent
1c02a451
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
src/utilities.cpp
+3
-0
src/validate.cpp
+11
-4
No files found.
src/utilities.cpp
View file @
ce14593f
...
@@ -911,6 +911,9 @@ std::unique_ptr<std::istream> resource_pool::load(fs::path name)
...
@@ -911,6 +911,9 @@ std::unique_ptr<std::istream> resource_pool::load(fs::path name)
if
(
mLocalResources
.
count
(
name
.
string
()))
if
(
mLocalResources
.
count
(
name
.
string
()))
result
=
open
(
mLocalResources
[
name
.
string
()]);
result
=
open
(
mLocalResources
[
name
.
string
()]);
if
(
fs
::
exists
(
p
,
ec
)
and
not
ec
)
result
=
open
(
p
);
for
(
auto
di
=
mDirs
.
begin
();
not
result
and
di
!=
mDirs
.
end
();
++
di
)
for
(
auto
di
=
mDirs
.
begin
();
not
result
and
di
!=
mDirs
.
end
();
++
di
)
{
{
auto
p2
=
*
di
/
p
;
auto
p2
=
*
di
/
p
;
...
...
src/validate.cpp
View file @
ce14593f
...
@@ -24,10 +24,10 @@
...
@@ -24,10 +24,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
*/
#include "cif++/dictionary_parser.hpp"
#include "cif++/validate.hpp"
#include "cif++/validate.hpp"
#include "cif++/
utilities
.hpp"
#include "cif++/
dictionary_parser
.hpp"
#include "cif++/gzio.hpp"
#include "cif++/gzio.hpp"
#include "cif++/utilities.hpp"
#include <cassert>
#include <cassert>
#include <fstream>
#include <fstream>
...
@@ -401,6 +401,8 @@ void validator::report_error(const std::string &msg, bool fatal) const
...
@@ -401,6 +401,8 @@ void validator::report_error(const std::string &msg, bool fatal) const
const
validator
&
validator_factory
::
operator
[](
std
::
string_view
dictionary_name
)
const
validator
&
validator_factory
::
operator
[](
std
::
string_view
dictionary_name
)
{
{
try
{
std
::
lock_guard
lock
(
m_mutex
);
std
::
lock_guard
lock
(
m_mutex
);
for
(
auto
&
validator
:
m_validators
)
for
(
auto
&
validator
:
m_validators
)
...
@@ -426,8 +428,6 @@ const validator &validator_factory::operator[](std::string_view dictionary_name)
...
@@ -426,8 +428,6 @@ const validator &validator_factory::operator[](std::string_view dictionary_name)
}
}
// not found, add it
// not found, add it
auto
data
=
load_resource
(
dictionary_name
);
auto
data
=
load_resource
(
dictionary_name
);
if
(
not
data
and
dictionary
.
extension
().
string
()
!=
".dic"
)
if
(
not
data
and
dictionary
.
extension
().
string
()
!=
".dic"
)
...
@@ -482,6 +482,13 @@ const validator &validator_factory::operator[](std::string_view dictionary_name)
...
@@ -482,6 +482,13 @@ const validator &validator_factory::operator[](std::string_view dictionary_name)
}
}
return
m_validators
.
back
();
return
m_validators
.
back
();
}
catch
(
const
std
::
exception
&
ex
)
{
std
::
string
msg
=
"Error while loading dictionary "
;
msg
+=
dictionary_name
;
std
::
throw_with_nested
(
std
::
runtime_error
(
msg
));
}
}
}
void
validator_factory
::
construct_validator
(
std
::
string_view
name
,
std
::
istream
&
is
)
void
validator_factory
::
construct_validator
(
std
::
string_view
name
,
std
::
istream
&
is
)
...
...
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