summaryrefslogtreecommitdiffstats
path: root/src/common/haiku
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/haiku
Add the files
Diffstat (limited to 'src/common/haiku')
-rw-r--r--src/common/haiku/version.cpp26
-rw-r--r--src/common/haiku/version.h3
2 files changed, 29 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;
+}
diff --git a/src/common/haiku/version.h b/src/common/haiku/version.h
new file mode 100644
index 0000000..4f047a2
--- /dev/null
+++ b/src/common/haiku/version.h
@@ -0,0 +1,3 @@
+#include "common/FFstrbuf.h"
+
+bool ffGetFileVersion(const char* filePath, FFstrbuf* version);