mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-20 20:32:50 +12:00
Fixed: Getting selfpath on macos (fix for finding theme folder)
This commit is contained in:
parent
b48596486e
commit
a84a7e6a5c
11
src/btop.cpp
11
src/btop.cpp
|
@ -34,6 +34,8 @@ tab-size = 4
|
|||
#include <chrono>
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#include <btop_shared.hpp>
|
||||
|
@ -699,10 +701,17 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
//? Try to find global btop theme path relative to binary path
|
||||
#if defined(__linux__)
|
||||
#ifdef __linux__
|
||||
{ std::error_code ec;
|
||||
Global::self_path = fs::read_symlink("/proc/self/exe", ec).remove_filename();
|
||||
}
|
||||
#elif __APPLE__
|
||||
{
|
||||
char buf [PATH_MAX];
|
||||
uint32_t bufsize = PATH_MAX;
|
||||
if(!_NSGetExecutablePath(buf, &bufsize))
|
||||
Global::self_path = fs::path(buf).remove_filename();
|
||||
}
|
||||
#endif
|
||||
if (std::error_code ec; not Global::self_path.empty()) {
|
||||
Theme::theme_dir = fs::canonical(Global::self_path / "../share/btop/themes", ec);
|
||||
|
|
Loading…
Reference in a new issue