74{
75 std::string bcFilePath;
76
77 if (path == "SVF_DIR")
78 {
79 const char* svfdir =
getenv(
"SVF_DIR");
80 if (!svfdir)
81 return "";
82
83 bcFilePath = svfdir;
84
85 if (!bcFilePath.empty() && bcFilePath.back() != '/')
86 bcFilePath.push_back('/');
87
88 bcFilePath.append(SVF_BUILD_TYPE "-build/lib/extapi.bc");
89 }
90 else if (path == "npm root")
91 {
92
93
95 "command -v npm >/dev/null 2>&1 && npm root"
96 );
97
98 if (bcFilePath.empty())
99 return "";
100
101 if (!bcFilePath.empty() && bcFilePath.back() != '/')
102 bcFilePath.push_back('/');
103
104 bcFilePath.append("SVF/lib/extapi.bc");
105 }
106
107 return bcFilePath;
108}
char * getenv(const char *name)
std::string getStdoutFromCommand(const std::string &command)
Execute a shell command and capture its stdout output.