Exemplo n.º 1
0
int get_output_file_infos(RESULT const& result, vector<OUTPUT_FILE_INFO>& fis) {
    char path[MAXPATHLEN];
    string name;
    MIOFILE mf;
    mf.init_buf_read(result.xml_doc_in);
    XML_PARSER xp(&mf);
    fis.clear();
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("file_ref")) {
            OUTPUT_FILE_INFO fi;
            int retval =  fi.parse(xp);
            if (retval) return retval;
            if (standalone) {
                safe_strcpy(path, fi.name.c_str());
            } else {
                dir_hier_path(
                    fi.name.c_str(), config.upload_dir,
                    config.uldl_dir_fanout, path
                );
            }
			fi.path = path;
            fis.push_back(fi);
        }
    }
    return 0;
}
Exemplo n.º 2
0
int get_output_file_info(RESULT const& result, OUTPUT_FILE_INFO& fi) {
    char path[MAXPATHLEN];
    string name;
    MIOFILE mf;
    mf.init_buf_read(result.xml_doc_in);
    XML_PARSER xp(&mf);
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("file_ref")) {
            int retval = fi.parse(xp);
            if (retval) return retval;
            if (standalone) {
                safe_strcpy(path, fi.name.c_str());
                if (!path_to_filename(fi.name, name)) {
                    fi.name = name;
                }
            } else {
                dir_hier_path(
                    fi.name.c_str(), config.upload_dir,
                    config.uldl_dir_fanout, path
                );
            }
            fi.path = path;
            return 0;
        }
    }
    return ERR_XML_PARSE;
}