This commit is contained in:
2025-11-27 09:46:00 +01:00
7 changed files with 107 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
#include "utils/whereami.h"
#include <iostream>
#ifdef __linux
#if defined(__linux) || defined(TARGET_OS_OSX)
#include <unistd.h>
#endif
@@ -26,19 +26,19 @@ std::string InfoOverMe::containingFolder()
wai_getExecutablePath(path, len, NULL);
path[len] = '\0';
std::string p(path);
std::filesystem::path pp(p);
if (std::filesystem::is_regular_file(pp)) {
pp = pp.parent_path();
std::filesystem::path p(path);
if (std::filesystem::is_regular_file(p)) {
std::filesystem::path pp = p.parent_path();
return pp.string();
} else {
return p.string();
}
return pp.string();
}
std::string InfoOverMe::myHostname()
{
char buf[10240];
#ifdef __linux
#if defined(__linux) || defined(TARGET_OS_OSX)
int r = gethostname(buf, 10240);
#endif
#ifdef _WIN32
@@ -59,9 +59,13 @@ std::string InfoOverMe::myOsHostname()
#else
#ifdef _WIN32
os = "windows";
#else
#ifdef TARGET_OS_OSX
os = "osx";
#else
os = "unknown";
#endif
#endif
#endif
return os + "_" + myHostname();
}