blob: f8e65c3d5ec65f98ae66fddcbf232ab93c33cd91 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}
|