diff options
author | Petr Mrázek <peterix@users.noreply.github.com> | 2021-12-30 20:00:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 20:00:45 +0100 |
commit | 3efcccf334e28d03605dd0597f53f900105cf04b (patch) | |
tree | ecafd89c7eb90d04f428c907da86c7d6b134c166 /libraries | |
parent | 5e909a4e852a5bf3ba9dec9081b4839773bfc0ce (diff) | |
parent | f42c3a953c15b01632131435e4885f9acc3b1f1a (diff) | |
download | PrismLauncher-3efcccf334e28d03605dd0597f53f900105cf04b.tar.gz PrismLauncher-3efcccf334e28d03605dd0597f53f900105cf04b.tar.bz2 PrismLauncher-3efcccf334e28d03605dd0597f53f900105cf04b.zip |
Merge pull request #4345 from graemeg/freebsd-support
Adds FreeBSD support to MultiMC
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/iconfix/internal/qiconloader.cpp | 2 | ||||
-rw-r--r-- | libraries/systeminfo/src/sys_unix.cpp | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/libraries/iconfix/internal/qiconloader.cpp b/libraries/iconfix/internal/qiconloader.cpp index 41cf3d50..0d8466f0 100644 --- a/libraries/iconfix/internal/qiconloader.cpp +++ b/libraries/iconfix/internal/qiconloader.cpp @@ -320,7 +320,7 @@ Description: Make it so that the QIcon loader honors /usr/share/pixmaps icon theme specification. Bug: https://bugreports.qt.nokia.com/browse/QTBUG-12874 *********************************************************************/ -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) /* Freedesktop standard says to look in /usr/share/pixmaps last */ if (entries.isEmpty()) { diff --git a/libraries/systeminfo/src/sys_unix.cpp b/libraries/systeminfo/src/sys_unix.cpp index fb96c72c..b3098522 100644 --- a/libraries/systeminfo/src/sys_unix.cpp +++ b/libraries/systeminfo/src/sys_unix.cpp @@ -47,6 +47,7 @@ Sys::KernelInfo Sys::getKernelInfo() uint64_t Sys::getSystemRam() { std::string token; +#ifdef Q_OS_LINUX std::ifstream file("/proc/meminfo"); while(file >> token) { @@ -65,6 +66,19 @@ uint64_t Sys::getSystemRam() // ignore rest of the line file.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } +#elif defined(Q_OS_FREEBSD) + char buff[512]; + FILE *fp = popen("sysctl hw.physmem", "r"); + if (fp != NULL) + { + while(fgets(buff, 512, fp) != NULL) + { + std::string str(buff); + uint64_t mem = std::stoull(str.substr(12, std::string::npos)); + return mem * 1024ull; + } + } +#endif return 0; // nothing found } |