MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / get_executable_directory

Function get_executable_directory

src/common/utils.cpp:101–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101std::string get_executable_directory() {
102#ifdef _WIN32
103 char buffer[MAX_PATH];
104 GetModuleFileNameA(NULL, buffer, MAX_PATH);
105 std::string exe_path(buffer);
106 size_t last_slash = exe_path.find_last_of("\\");
107 if (last_slash != std::string::npos) {
108 return exe_path.substr(0, last_slash);
109 }
110 return ".";
111#else
112 char buffer[PATH_MAX] = {0};
113 ssize_t len = readlink("/proc/self/exe", buffer, sizeof(buffer) - 1);
114 if (len > 0) {
115 buffer[len] = '\0';
116 std::string exe_path(buffer);
117 size_t last_slash = exe_path.find_last_of("/");
118 if (last_slash != std::string::npos) {
119 return exe_path.substr(0, last_slash);
120 }
121 }
122 return ".";
123#endif
124}
125
126std::string get_user_directory() {
127#ifdef _WIN32

Callers 15

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by 15

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68