34 lines
1.3 KiB
Vala
34 lines
1.3 KiB
Vala
extern const string GETTEXT_PACKAGE;
|
|
|
|
public static int main (string[] args) {
|
|
try {
|
|
File exec_file = File.new_for_path (Environment.find_program_in_path (args[0]));
|
|
string resource_file = Path.build_path (Path.DIR_SEPARATOR_S, exec_file.get_parent().get_parent().get_path(),
|
|
"share/gresource-test-"+Config.VERSION_MAJOR.to_string()+"/gresource-test.gresource");
|
|
|
|
var res = Resource.load (resource_file);
|
|
//res._register();
|
|
string[] children = res.enumerate_children ("/ws/backbone/gresource-test", ResourceLookupFlags.NONE);
|
|
|
|
// print all files info
|
|
var i = 0;
|
|
foreach (var c in children) {
|
|
size_t size;
|
|
uint32 flags;
|
|
stdout.printf ("child[%d] = %s", i++, c);
|
|
if (res.get_info ("/ws/backbone/gresource-test/" + c, ResourceLookupFlags.NONE, out size, out flags))
|
|
stdout.printf (", size = %u%s\n", (uint)size, flags == ResourceFlags.COMPRESSED ? ", compressed" : "");
|
|
}
|
|
|
|
// print first 64 bytes of gwhois.css
|
|
var gwhois_css_data = res.lookup_data ("/ws/backbone/gresource-test/gwhois.css",
|
|
ResourceLookupFlags.NONE);
|
|
stdout.printf ("First 64 bytes of gwhois.css:\n%s\n", ((string)gwhois_css_data.get_data()).substring(0,64));
|
|
|
|
} catch (Error e) {
|
|
stdout.printf ("Error: %s\n", e.message);
|
|
}
|
|
|
|
return 0;
|
|
}
|