MCPcopy Create free account
hub / github.com/alibaba/GraphScope / get_current_dir

Function get_current_dir

flex/utils/service_utils.cc:24–39  ·  view source on GitHub ↗

get current executable's directory

Source from the content-addressed store, hash-verified

22
23// get current executable's directory
24std::string get_current_dir() {
25 char buf[1024];
26 int dirfd = open("/proc/self/", O_RDONLY | O_DIRECTORY);
27 if (dirfd == -1) {
28 // Handle error
29 }
30
31 ssize_t len = readlinkat(dirfd, "exe", buf, sizeof(buf) - 1);
32 if (len == -1) {
33 // Handle error
34 }
35 buf[len] = '\0';
36 close(dirfd);
37 std::string exe_path(buf);
38 return exe_path.substr(0, exe_path.rfind('/'));
39}
40
41std::string find_codegen_bin() {
42 // first check whether flex_home env exists

Callers 1

find_codegen_binFunction · 0.85

Calls 3

openFunction · 0.85
closeFunction · 0.85
substrMethod · 0.80

Tested by

no test coverage detected