update/update.c
changeset 25 e10f418d8e1d
parent 13 b0a35bae4961
child 31 a53fcb780468
     1.1 --- a/update/update.c	Thu Nov 10 11:15:09 2011 +0000
     1.2 +++ b/update/update.c	Sat Nov 15 19:10:51 2014 +0000
     1.3 @@ -27,18 +27,20 @@
     1.4  
     1.5  void update(const char *argv0)
     1.6  {
     1.7 -    char *path,*s,*prefix;
     1.8 +    char *path;
     1.9 +    gchar *s,*prefix;
    1.10      int ch;
    1.11      struct comps *comps;
    1.12 +    GError *error=NULL;
    1.13      path=plover_get_program_directory(argv0);
    1.14 -    s=plover_strconcat(path,"/repodata/comps.xml",NULL);
    1.15 +    s=g_strconcat(path,"/repodata/comps.xml",NULL);
    1.16      comps=plover_comps_new_from_file(s);
    1.17      if (!comps)
    1.18      {
    1.19  	perror(s);
    1.20  	exit(1);
    1.21      }
    1.22 -    free(s);
    1.23 +    g_free(s);
    1.24      prefix=plover_default_prefix_for_vendor(comps->vendor);
    1.25      if (!plover_installed_files_match_prefix(prefix))
    1.26      {
    1.27 @@ -50,11 +52,21 @@
    1.28  	    exit(1);
    1.29  	while(ch!='\n' && ch!=EOF)
    1.30  	    ch=getchar();
    1.31 -	plover_remove(NULL);
    1.32 +	if (plover_remove(NULL,&error))
    1.33 +	{
    1.34 +	    fprintf(stderr,"%s\n",error->message);
    1.35 +	    g_error_free(error);
    1.36 +	    exit(1);
    1.37 +	}
    1.38      }
    1.39      plover_comps_free(comps);
    1.40 -    plover_update(path,prefix,NULL);
    1.41 -    free(prefix);
    1.42 +    if (!plover_update(path,prefix,NULL,&error))
    1.43 +    {
    1.44 +	fprintf(stderr,"%s\n",error->message);
    1.45 +	g_error_free(error);
    1.46 +	exit(1);
    1.47 +    }
    1.48 +    g_free(prefix);
    1.49      free(path);
    1.50  }
    1.51