/[jscoverage]/trunk/jscoverage-server.c
ViewVC logotype

Diff of /trunk/jscoverage-server.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 125 by siliconforks, Mon Jun 2 17:52:38 2008 UTC revision 133 by siliconforks, Thu Jun 19 05:53:29 2008 UTC
# Line 526  Line 526 
526    
527      mkdir_if_necessary(report_directory);      mkdir_if_necessary(report_directory);
528      char * path = make_path(report_directory, "jscoverage.json");      char * path = make_path(report_directory, "jscoverage.json");
529      FILE * f = fopen(path, "r");  
530      if (f != NULL) {      /* check if the JSON file exists */
531        struct stat buf;
532        if (stat(path, &buf) == 0) {
533        /* it exists: merge */        /* it exists: merge */
534        result = merge(coverage, f);        FILE * f = fopen(path, "r");
535        if (fclose(f) == EOF) {        if (f == NULL) {
536          result = 1;          result = 1;
537        }        }
538          else {
539            result = merge(coverage, f);
540            if (fclose(f) == EOF) {
541              result = 1;
542            }
543          }
544        if (result != 0) {        if (result != 0) {
545          free(path);          free(path);
546          Coverage_delete(coverage);          Coverage_delete(coverage);
# Line 552  Line 560 
560      /* copy other files */      /* copy other files */
561      jscoverage_copy_resources(report_directory);      jscoverage_copy_resources(report_directory);
562      path = make_path(report_directory, "jscoverage.js");      path = make_path(report_directory, "jscoverage.js");
563      f = fopen(path, "ab");      FILE * f = fopen(path, "ab");
564      free(path);      free(path);
565      if (f == NULL) {      if (f == NULL) {
566        send_response(exchange, 500, "Could not write to file: jscoverage.js\n");        send_response(exchange, 500, "Could not write to file: jscoverage.js\n");

Legend:
Removed from v.125  
changed lines
  Added in v.133

  ViewVC Help
Powered by ViewVC 1.1.24