mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
e0eba8ce21
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
27 lines
575 B
C++
27 lines
575 B
C++
extern "C" {
|
|
#include "version.h"
|
|
}
|
|
|
|
#include <File.h>
|
|
#include <AppFileInfo.h>
|
|
|
|
bool ffGetFileVersion(const char* filePath, FFstrbuf* version) {
|
|
BFile f(filePath, B_READ_ONLY);
|
|
if (f.InitCheck() != B_OK) {
|
|
return false;
|
|
}
|
|
|
|
BAppFileInfo fileInfo(&f);
|
|
if (f.InitCheck() != B_OK) {
|
|
return false;
|
|
}
|
|
|
|
version_info info;
|
|
if (fileInfo.GetVersionInfo(&info, B_SYSTEM_VERSION_KIND) != B_OK) {
|
|
return false;
|
|
}
|
|
|
|
ffStrbufSetF(version, "%d.%d.%d", (int) info.major, (int) info.middle, (int) info.minor);
|
|
return true;
|
|
}
|