~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to sched/sample_assimilator.cpp

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
int write_error(char* p) {
37
37
    static FILE* f = 0;
38
38
    if (!f) {
39
 
        f = fopen("../sample_results/errors", "a");
 
39
        f = fopen(config.project_path("sample_results/errors"), "a");
40
40
        if (!f) return ERR_FOPEN;
41
41
    }
42
42
    fprintf(f, "%s", p);
51
51
    char buf[1024];
52
52
    unsigned int i;
53
53
 
54
 
    retval = boinc_mkdir("../sample_results");
 
54
    retval = boinc_mkdir(config.project_path("sample_results"));
55
55
    if (retval) return retval;
56
56
 
57
57
    if (wu.canonical_resultid) {
58
58
        vector<FILE_INFO> output_files;
59
 
        char copy_path[256];
 
59
        const char *copy_path;
60
60
        get_output_file_infos(canonical_result, output_files);
61
61
        unsigned int n = output_files.size();
 
62
        bool file_copied = false;
62
63
        for (i=0; i<n; i++) {
63
64
            FILE_INFO& fi = output_files[i];
64
65
            if (n==1) {
65
 
                sprintf(copy_path, "../sample_results/%s", wu.name);
 
66
                copy_path = config.project_path("sample_results/%s", wu.name);
66
67
            } else {
67
 
                sprintf(copy_path, "../sample_results/%s_%d", wu.name, i);
 
68
                copy_path = config.project_path("sample_results/%s_%d", wu.name, i);
68
69
            }
69
70
            retval = boinc_copy(fi.path.c_str() , copy_path);
70
 
            if (retval && !fi.optional) {
71
 
                sprintf(buf, "couldn't copy file %s\n", fi.path.c_str());
72
 
                write_error(buf);
73
 
                return retval;
 
71
            if (!retval) {
 
72
                file_copied = true;
74
73
            }
75
74
        }
 
75
        if (!file_copied) {
 
76
            copy_path = config.project_path(
 
77
                "sample_results/%s_%s", wu.name, "no_output_files"
 
78
            );
 
79
            FILE* f = fopen(copy_path, "w");
 
80
            fclose(f);
 
81
        }
76
82
    } else {
77
83
        sprintf(buf, "%s: 0x%x\n", wu.name, wu.error_mask);
78
84
        return write_error(buf);