Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
85b90ae9
Commit
85b90ae9
authored
12 years ago
by
Marco Biasini
Browse files
Options
Downloads
Patches
Plain Diff
Use NSGetExecutablePath on MacOS X
parent
4a80d0e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/molck/main.cc
+15
-10
15 additions, 10 deletions
tools/molck/main.cc
with
15 additions
and
10 deletions
tools/molck/main.cc
+
15
−
10
View file @
85b90ae9
...
...
@@ -9,6 +9,9 @@
#include
<ost/io/mol/pdb_writer.hh>
#include
<ost/io/io_exception.hh>
#include
<ost/conop/nonstandard.hh>
#if defined(__APPLE__)
#include
<mach-o/dyld.h>
#endif
using
namespace
ost
;
using
namespace
ost
::
conop
;
using
namespace
ost
::
mol
;
...
...
@@ -51,16 +54,20 @@ int main(int argc, char *argv[])
String
color
;
bool
colored
=
false
;
char
result
[
1024
];
ssize_t
count
=
readlink
(
"/proc/self/exe"
,
result
,
1024
);
String
exe_path
=
std
::
string
(
result
,
(
count
>
0
)
?
count
:
0
);
char
result
[
1024
];
CompoundLibPtr
lib
=
CompoundLib
::
Load
(
"compounds.chemlib"
);
#if !(defined(__APPLE__))
if
(
count
==
0
)
{
String
exe_path
;
#if defined(__APPLE__)
uint32_t
size
=
1023
;
if
(
!
_NSGetExecutablePath
(
result
,
&
size
))
{
exe_path
=
String
(
result
);
}
#else
ssize_t
count
=
readlink
(
"/proc/self/exe"
,
result
,
1024
);
String
exe_path
=
std
::
string
(
result
,
(
count
>
0
)
?
count
:
0
);
#endif
if
(
exe_path
.
empty
())
{
std
::
cerr
<<
"Could not determine the path of the molck executable. Will only look for compounds.chemlib in the current working directory"
<<
std
::
endl
;
}
else
{
fs
::
path
path_and_exe
(
exe_path
);
...
...
@@ -78,8 +85,6 @@ int main(int argc, char *argv[])
lib
=
CompoundLib
::
Load
(
share_path_string
);
}
#endif
if
(
!
lib
)
{
std
::
cerr
<<
"Could not load compounds.chemlib"
<<
std
::
endl
;
exit
(
-
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment