mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-23 08:28:33 +00:00
a3696c0b91
lib/sysdep: clean up by moving OS and cpu-arch folders into "os" and "arch" folders This was SVN commit r6162.
23 lines
400 B
C++
23 lines
400 B
C++
#include "precompiled.h"
|
|
|
|
#include "lib/sysdep/sysdep.h"
|
|
|
|
#define GNU_SOURCE
|
|
#include <dlfcn.h>
|
|
|
|
LibError sys_get_executable_name(char* n_path, size_t buf_size)
|
|
{
|
|
Dl_info dl_info;
|
|
|
|
memset(&dl_info, 0, sizeof(dl_info));
|
|
if (!dladdr((void *)sys_get_executable_name, &dl_info) ||
|
|
!dl_info.dli_fname )
|
|
{
|
|
return ERR::NO_SYS;
|
|
}
|
|
|
|
strncpy(n_path, dl_info.dli_fname, buf_size);
|
|
return INFO::OK;
|
|
}
|
|
|