Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Nicolas Pope
ftl
Commits
ba219c6c
Commit
ba219c6c
authored
4 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Check env var for runtime location
parent
552861d3
No related branches found
No related tags found
No related merge requests found
Pipeline
#33795
passed
4 years ago
Stage: all
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SDK/CPP/public/voltu.cpp
+19
-7
19 additions, 7 deletions
SDK/CPP/public/voltu.cpp
with
19 additions
and
7 deletions
SDK/CPP/public/voltu.cpp
+
19
−
7
View file @
ba219c6c
...
...
@@ -18,6 +18,7 @@
#include
<unistd.h>
#endif
#include
<cstdlib>
#include
<iostream>
static
bool
g_init
=
false
;
...
...
@@ -54,7 +55,8 @@ static void unloadLibrary(Library lib)
#endif
}
static
bool
is_file
(
const
std
::
string
&
path
)
{
static
bool
is_file
(
const
std
::
string
&
path
)
{
#ifdef WIN32
WIN32_FIND_DATA
ffd
;
HANDLE
hFind
=
FindFirstFile
(
path
.
c_str
(),
&
ffd
);
...
...
@@ -64,9 +66,12 @@ static bool is_file(const std::string &path) {
return
true
;
#else
struct
stat
s
;
if
(
::
stat
(
path
.
c_str
(),
&
s
)
==
0
)
{
if
(
::
stat
(
path
.
c_str
(),
&
s
)
==
0
)
{
return
true
;
}
else
{
}
else
{
return
false
;
}
#endif
...
...
@@ -80,13 +85,20 @@ static std::string locateLibrary()
#else
std
::
string
name
=
"libvoltu.so"
;
std
::
string
vname
=
name
+
std
::
string
(
"."
)
+
std
::
to_string
(
VOLTU_VERSION_MAJOR
)
+
std
::
string
(
"."
)
+
std
::
to_string
(
VOLTU_VERSION_MINOR
);
if
(
const
char
*
env_p
=
std
::
getenv
(
"VOLTU_RUNTIME"
))
{
if
(
is_file
(
env_p
))
return
env_p
;
}
// FIXME: Should eventually not have these...
if
(
is_file
(
std
::
string
(
"./"
)
+
vname
))
return
std
::
string
(
"./"
)
+
vname
;
else
if
(
is_file
(
std
::
string
(
"./"
)
+
name
))
return
std
::
string
(
"./"
)
+
name
;
//
else if (is_file(std::string("./") + name)) return std::string("./") + name;
else
if
(
is_file
(
std
::
string
(
"../"
)
+
vname
))
return
std
::
string
(
"../"
)
+
vname
;
else
if
(
is_file
(
std
::
string
(
"../"
)
+
name
))
return
std
::
string
(
"../"
)
+
name
;
/*
else if (is_file(std::string("../") + name)) return std::string("../") + name;
else if (is_file(std::string("/usr/local/lib/") + vname)) return std::string("/usr/local/lib/") + vname;
else
if
(
is_file
(
std
::
string
(
"/usr/local/lib/"
)
+
name
))
return
std
::
string
(
"/usr/local/lib/"
)
+
name
;
return
name
;
else if (is_file(std::string("/usr/local/lib/") + name)) return std::string("/usr/local/lib/") + name;
*/
return
v
name
;
#endif
}
...
...
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