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
a5f61664
Unverified
Commit
a5f61664
authored
May 18, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
locating resources that might be protected
parent
501050e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
src/CifUtils.cpp
+23
-14
No files found.
src/CifUtils.cpp
View file @
a5f61664
...
...
@@ -1220,42 +1220,47 @@ void addFileResource(const std::string &name, std::filesystem::path dataFile)
std
::
unique_ptr
<
std
::
istream
>
loadResource
(
std
::
filesystem
::
path
name
)
{
std
::
unique_ptr
<
std
::
istream
>
result
;
std
::
error_code
ec
;
fs
::
path
p
=
name
;
if
(
gLocalResources
.
count
(
name
.
string
()))
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
gLocalResources
[
name
.
string
()],
std
::
ios
::
binary
));
if
(
file
->
is_open
())
result
.
reset
(
file
.
release
());
try
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
gLocalResources
[
name
.
string
()],
std
::
ios
::
binary
));
if
(
file
->
is_open
())
result
.
reset
(
file
.
release
());
}
catch
(...)
{}
}
if
(
not
result
and
not
fs
::
exists
(
p
)
and
not
gDataDir
.
empty
())
if
(
not
result
and
(
not
fs
::
exists
(
p
,
ec
)
or
ec
)
and
not
gDataDir
.
empty
())
p
=
gDataDir
/
name
;
#if defined(CACHE_DIR)
if
(
not
result
and
not
fs
::
exists
(
p
))
if
(
not
result
and
(
not
fs
::
exists
(
p
,
ec
)
or
ec
))
{
auto
p2
=
fs
::
path
(
CACHE_DIR
)
/
p
;
if
(
fs
::
exists
(
p2
)
)
if
(
fs
::
exists
(
p2
,
ec
)
and
not
ec
)
swap
(
p
,
p2
);
}
#endif
#if defined(DATA_DIR)
if
(
not
result
and
not
fs
::
exists
(
p
))
if
(
not
result
and
(
not
fs
::
exists
(
p
,
ec
)
or
ec
))
{
auto
p2
=
fs
::
path
(
DATA_DIR
)
/
p
;
if
(
fs
::
exists
(
p2
)
)
if
(
fs
::
exists
(
p2
,
ec
)
and
not
ec
)
swap
(
p
,
p2
);
}
#endif
#if defined(CCP4) and CCP4
if
(
not
result
and
not
fs
::
exists
(
p
))
if
(
not
result
and
(
not
fs
::
exists
(
p
,
ec
)
or
ec
))
{
const
char
*
CCP4_DIR
=
getenv
(
"CCP4"
);
if
(
CCP4_DIR
!=
nullptr
and
fs
::
exists
(
CCP4_DIR
)
)
if
(
CCP4_DIR
!=
nullptr
and
fs
::
exists
(
CCP4_DIR
,
ec
)
and
not
ec
)
{
auto
p2
=
fs
::
path
(
DATA_DIR
)
/
p
;
if
(
fs
::
exists
(
p2
))
...
...
@@ -1264,11 +1269,15 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
}
#endif
if
(
not
result
and
fs
::
exists
(
p
)
)
if
(
not
result
and
fs
::
exists
(
p
,
ec
)
and
not
ec
)
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
p
,
std
::
ios
::
binary
));
if
(
file
->
is_open
())
result
.
reset
(
file
.
release
());
try
{
std
::
unique_ptr
<
std
::
ifstream
>
file
(
new
std
::
ifstream
(
p
,
std
::
ios
::
binary
));
if
(
file
->
is_open
())
result
.
reset
(
file
.
release
());
}
catch
(...)
{}
}
if
(
not
result
and
gResourceData
)
...
...
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