diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/haiku/version.cpp | |
Add the files
Diffstat (limited to 'src/common/haiku/version.cpp')
| -rw-r--r-- | src/common/haiku/version.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/haiku/version.cpp b/src/common/haiku/version.cpp new file mode 100644 index 0000000..f8e65c3 --- /dev/null +++ b/src/common/haiku/version.cpp @@ -0,0 +1,26 @@ +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; +} |