/[jscoverage]/trunk/instrument.c
ViewVC logotype

Diff of /trunk/instrument.c

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

revision 241 by siliconforks, Fri Oct 3 23:52:10 2008 UTC revision 361 by siliconforks, Sun Oct 26 05:28:03 2008 UTC
# Line 162  Line 162 
162        fatal("not a directory: %s", destination);        fatal("not a directory: %s", destination);
163      }      }
164      if (! directory_is_empty(destination)) {      if (! directory_is_empty(destination)) {
165        char * jscoverage_html = make_path(destination, "jscoverage.html");        char * expected_file = NULL;
166        if (stat(jscoverage_html, &buf) == -1) {        if (jscoverage_mozilla) {
167            char * modules_directory = make_path(destination, "modules");
168            expected_file = make_path(modules_directory, "jscoverage.jsm");
169            free(modules_directory);
170          }
171          else {
172            expected_file = make_path(destination, "jscoverage.html");
173          }
174          if (stat(expected_file, &buf) == -1) {
175          fatal("refusing to overwrite directory: %s", destination);          fatal("refusing to overwrite directory: %s", destination);
176        }        }
177        free(jscoverage_html);        free(expected_file);
178      }      }
179    }    }
180    else if (errno == ENOENT) {    else if (errno == ENOENT) {
# Line 176  Line 184 
184      fatal("cannot stat directory: %s", destination);      fatal("cannot stat directory: %s", destination);
185    }    }
186    
   /* copy the resources */  
   jscoverage_copy_resources(destination);  
   
187    /* finally: copy the directory */    /* finally: copy the directory */
188    struct DirListEntry * list = make_recursive_dir_list(source);    struct DirListEntry * list = make_recursive_dir_list(source);
189    for (struct DirListEntry * p = list; p != NULL; p = p->next) {    for (struct DirListEntry * p = list; p != NULL; p = p->next) {
# Line 216  Line 221 
221      free(s);      free(s);
222      free(d);      free(d);
223    }    }
224    
225      /* copy the resources */
226      if (jscoverage_mozilla) {
227        char * chrome_directory = make_path(destination, "chrome");
228        char * jscoverage_chrome_directory = make_path(chrome_directory, "jscoverage");
229        mkdir_if_necessary(jscoverage_chrome_directory);
230        copy_resource("jscoverage.manifest", chrome_directory);
231        copy_resource("jscoverage.html", jscoverage_chrome_directory);
232        copy_resource("jscoverage.css", jscoverage_chrome_directory);
233        copy_resource("jscoverage.js", jscoverage_chrome_directory);
234        copy_resource("jscoverage-throbber.gif", jscoverage_chrome_directory);
235        copy_resource("jscoverage-highlight.css", jscoverage_chrome_directory);
236        copy_resource("jscoverage.xul", jscoverage_chrome_directory);
237        copy_resource("jscoverage-overlay.js", jscoverage_chrome_directory);
238        free(jscoverage_chrome_directory);
239        free(chrome_directory);
240    
241        char * modules_directory = make_path(destination, "modules");
242        copy_resource("jscoverage.jsm", modules_directory);
243        free(modules_directory);
244      }
245      else {
246        jscoverage_copy_resources(destination);
247      }
248    
249    free_dir_list(list);    free_dir_list(list);
250  }  }

Legend:
Removed from v.241  
changed lines
  Added in v.361

  ViewVC Help
Powered by ViewVC 1.1.24