mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-03 11:04:39 +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>
|
#include <chrono>
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <btop_shared.hpp>
|
#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
|
//? Try to find global btop theme path relative to binary path
|
||||||
#if defined(__linux__)
|
#ifdef __linux__
|
||||||
{ std::error_code ec;
|
{ std::error_code ec;
|
||||||
Global::self_path = fs::read_symlink("/proc/self/exe", ec).remove_filename();
|
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
|
#endif
|
||||||
if (std::error_code ec; not Global::self_path.empty()) {
|
if (std::error_code ec; not Global::self_path.empty()) {
|
||||||
Theme::theme_dir = fs::canonical(Global::self_path / "../share/btop/themes", ec);
|
Theme::theme_dir = fs::canonical(Global::self_path / "../share/btop/themes", ec);
|
||||||
|
|
Loading…
Reference in a new issue