1.1 --- a/update/updatez.c Thu Jul 07 19:03:54 2016 +0100
1.2 +++ b/update/updatez.c Fri Jul 08 08:33:44 2016 +0100
1.3 @@ -1,5 +1,5 @@
1.4 /*
1.5 - * Copyright (C) 2009, 2011 J. Ali Harlow <ali@juiblex.co.uk>
1.6 + * Copyright (C) 2009, 2011, 2016 J. Ali Harlow <ali@juiblex.co.uk>
1.7 *
1.8 * This program is free software; you can redistribute it and/or modify
1.9 * it under the terms of the GNU General Public License as published by
1.10 @@ -25,16 +25,18 @@
1.11
1.12 LUALIB_API int luaopen_posix(lua_State *L);
1.13
1.14 -void update(const char *argv0)
1.15 +void update_from_executable_zip(const char *argv0)
1.16 {
1.17 - char *path;
1.18 + char *uri;
1.19 gchar *s,*prefix;
1.20 int ch;
1.21 struct comps *comps;
1.22 GError *error=NULL;
1.23 - path=plover_get_program_directory(argv0);
1.24 - s=g_strconcat(path,"/repodata/comps.xml",NULL);
1.25 - comps=plover_comps_new_from_file(s);
1.26 + s=plover_get_program(argv0);
1.27 + uri=g_strconcat("file:",s,NULL);
1.28 + g_free(s);
1.29 + s=g_strconcat(uri,"/repodata/comps.xml",NULL);
1.30 + comps=plover_comps_new_from_uri(s);
1.31 if (!comps)
1.32 {
1.33 perror(s);
1.34 @@ -60,14 +62,14 @@
1.35 }
1.36 }
1.37 plover_comps_free(comps);
1.38 - if (!plover_update(path,prefix,NULL,&error))
1.39 + if (!plover_update_uri(uri,prefix,NULL,&error))
1.40 {
1.41 fprintf(stderr,"%s\n",error->message);
1.42 g_error_free(error);
1.43 exit(1);
1.44 }
1.45 g_free(prefix);
1.46 - free(path);
1.47 + free(uri);
1.48 }
1.49
1.50 int main(int argc,char **argv)
1.51 @@ -75,6 +77,6 @@
1.52 plover_exception_handler_init();
1.53 razor_set_lua_loader("posix",(void (*)())luaopen_posix);
1.54 razor_set_lua_loader("whelk",(void (*)())luaopen_whelk);
1.55 - update(argv[0]);
1.56 + update_from_executable_zip(argv[0]);
1.57 exit(0);
1.58 }