MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Process_RawGetExePath

Function Process_RawGetExePath

src/Platform_Posix.c:1042–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040/* Retrieving exe path is completely OS dependant */
1041#if defined CC_BUILD_MACOS
1042static cc_result Process_RawGetExePath(char* path, int* len) {
1043 Mem_Set(path, '\0', NATIVE_STR_LEN);
1044 cc_uint32 size = NATIVE_STR_LEN;
1045 if (_NSGetExecutablePath(path, &size)) return ERR_INVALID_ARGUMENT;
1046
1047 /* despite what you'd assume, size is NOT changed to length of path */
1048 *len = String_CalcLen(path, NATIVE_STR_LEN);
1049 return 0;
1050}
1051#elif defined CC_BUILD_LINUX || defined CC_BUILD_SERENITY
1052static cc_result Process_RawGetExePath(char* path, int* len) {
1053 *len = readlink("/proc/self/exe", path, NATIVE_STR_LEN);

Callers 4

Process_StartGame2Function · 0.70
Updater_StartFunction · 0.70
Updater_GetBuildTimeFunction · 0.70

Calls 3

Mem_SetFunction · 0.85
String_CalcLenFunction · 0.85
Mem_CopyFunction · 0.85

Tested by

no test coverage detected