The Meson Build System
http://mesonbuild.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
807 B
28 lines
807 B
10 years ago
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
#include<gio/gio.h>
|
||
8 years ago
|
#include"generated-resources.h"
|
||
10 years ago
|
|
||
8 years ago
|
#define EXPECTED "This is a generated resource.\n"
|
||
10 years ago
|
|
||
|
int main(int argc, char **argv) {
|
||
8 years ago
|
GResource *res = generated_resources_get_resource();
|
||
10 years ago
|
GError *err = NULL;
|
||
8 years ago
|
GBytes *data = g_resources_lookup_data("/com/example/myprog/res3.txt",
|
||
10 years ago
|
G_RESOURCE_LOOKUP_FLAGS_NONE, &err);
|
||
|
|
||
|
if(data == NULL) {
|
||
|
fprintf(stderr, "Data lookup failed: %s\n", err->message);
|
||
|
return 1;
|
||
|
}
|
||
|
if(strcmp(g_bytes_get_data(data, NULL), EXPECTED) != 0) {
|
||
|
fprintf(stderr, "Resource contents are wrong:\n %s\n",
|
||
|
(const char*)g_bytes_get_data(data, NULL));
|
||
|
return 1;
|
||
|
}
|
||
8 years ago
|
fprintf(stdout, "All ok.\n");
|
||
10 years ago
|
g_bytes_unref(data);
|
||
|
g_resource_unref(res);
|
||
|
return 0;
|
||
|
}
|