diff -r 4b52e95a0104 -r 772ff096a326 update/updatez.c --- a/update/updatez.c Thu Jul 07 19:03:54 2016 +0100 +++ b/update/updatez.c Fri Jul 08 08:33:44 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011 J. Ali Harlow + * Copyright (C) 2009, 2011, 2016 J. Ali Harlow * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,16 +25,18 @@ LUALIB_API int luaopen_posix(lua_State *L); -void update(const char *argv0) +void update_from_executable_zip(const char *argv0) { - char *path; + char *uri; gchar *s,*prefix; int ch; struct comps *comps; GError *error=NULL; - path=plover_get_program_directory(argv0); - s=g_strconcat(path,"/repodata/comps.xml",NULL); - comps=plover_comps_new_from_file(s); + s=plover_get_program(argv0); + uri=g_strconcat("file:",s,NULL); + g_free(s); + s=g_strconcat(uri,"/repodata/comps.xml",NULL); + comps=plover_comps_new_from_uri(s); if (!comps) { perror(s); @@ -60,14 +62,14 @@ } } plover_comps_free(comps); - if (!plover_update(path,prefix,NULL,&error)) + if (!plover_update_uri(uri,prefix,NULL,&error)) { fprintf(stderr,"%s\n",error->message); g_error_free(error); exit(1); } g_free(prefix); - free(path); + free(uri); } int main(int argc,char **argv) @@ -75,6 +77,6 @@ plover_exception_handler_init(); razor_set_lua_loader("posix",(void (*)())luaopen_posix); razor_set_lua_loader("whelk",(void (*)())luaopen_whelk); - update(argv[0]); + update_from_executable_zip(argv[0]); exit(0); }