The BEOS:APP_VERSION field is now also decompiled to nice plain text.

However, an eventual existing system version info is dropped - support for this
(also on the compilation side) should be implemented as well some day.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17824 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-06-13 15:24:11 +00:00
parent 0e50eab75e
commit c5bbddb66c

View File

@ -20,6 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <AppFileInfo.h>
#include <Mime.h>
#include <Resources.h>
#include <Roster.h>
@ -723,6 +725,51 @@ write_app_file_types(const void *data, size_t length)
write_other(NULL, B_MESSAGE_TYPE, data, length);
}
static void
write_app_version(const void *data, size_t length)
{
const version_info *version = (const version_info *)data;
//const version_info *systemVersion = version + 1;
fputs("resource app_version", sOutputFile);
open_brace();
fprintf(sOutputFile, "\tmajor = %ld,\n"
"\tmiddle = %ld,\n"
"\tminor = %ld,\n\n", version->major, version->middle, version->minor);
const char *variety = "B_APPV_DEVELOPMENT";
switch (version->variety) {
case 1:
variety = "B_APPV_ALPHA";
break;
case 2:
variety = "B_APPV_BETA";
break;
case 3:
variety = "B_APPV_GAMMA";
break;
case 4:
variety = "B_APPV_GOLDEN_MASTER";
break;
case 5:
variety = "B_APPV_FINAL";
break;
}
fprintf(sOutputFile, "\tvariety = %s,\n"
"\tinternal = %ld,\n\n", variety, version->internal);
fprintf(sOutputFile, "\tshort_info = ");
write_string(NULL, B_STRING_TYPE, version->short_info, strlen(version->short_info));
fprintf(sOutputFile, ",\n\tlong_info = ");
write_string(NULL, B_STRING_TYPE, version->long_info, strlen(version->long_info));
close_brace();
}
// #pragma mark - file examination
@ -803,11 +850,18 @@ write_data(int32 id, const char *name, type_code type,
break;
case 'APPF':
if (length == 4) {
if (!strcmp(name, "BEOS:APP_FLAGS") && length == 4) {
write_app_flags(data, length);
return;
}
break;
case 'APPV':
if (!strcmp(name, "BEOS:APP_VERSION") && length == sizeof(version_info) * 2) {
write_app_version(data, length);
return;
}
break;
}
// write generic types