You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
320 B
C++

#pragma once
#include <filesystem>
#include <fstream>
#include <iostream>
#include <limits.h>
#include <unistd.h>
std::filesystem::path getExeDir()
{
char buf[PATH_MAX] = {0};
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf)-1);
return std::filesystem::path(std::string(buf, len)).parent_path();
}