20#ifdef FREECIV_HAVE_SYS_TYPES_H
23#ifdef HAVE_SYS_SOCKET_H
24#include <sys/socket.h>
54static void nf_cb(
const char *msg,
void *data)
100 return _(
"Recursive dependencies too deep");
103 if (URL ==
NULL || URL[0] ==
'\0') {
104 return _(
"No URL given");
110 return _(
"This does not look like modpack URL");
120 return _(
"This does not look like modpack URL");
126 return _(
"Cannot install to given directory hierarchy");
139 if (control ==
NULL) {
140 return _(
"Failed to get and parse modpack control file");
146 return _(
"Modpack control file has no capability string");
156 return _(
"Modpack control file is incompatible");
161 return _(
"Modpack name not defined in control file");
165 return _(
"Modpack version not defined in control file");
171 return _(
"Illegal modpack type");
185 "dependencies.list%d.modpack",
dep);
194 "dependencies.list%d.URL",
dep);
197 return _(
"Dependency has no download URL");
203 return _(
"Illegal dependency modpack type");
212 "dependencies.list%d.version",
dep);
226 mcb(
_(
"Download dependency modpack"));
312#ifndef DIR_SEPARATOR_IS_DEFAULT
315#define dest_name_copy dest_name
329#ifndef DIR_SEPARATOR_IS_DEFAULT
346#ifndef DIR_SEPARATOR_IS_DEFAULT
355#ifndef DIR_SEPARATOR_IS_DEFAULT
365#ifndef DIR_SEPARATOR_IS_DEFAULT
371 return _(
"Cannot create required directories");
394#ifndef DIR_SEPARATOR_IS_DEFAULT
414 return _(
"Some parts of the modpack failed to install.");
441 return _(
"Cannot fetch and parse modpack list");
451 return _(
"Invalid modpack list URL");
457 return _(
"Modpack list has no capability string");
461 log_error(
"Incompatible modpack list file:");
467 return _(
"Modpack list is incompatible");
488 "modpacks.list%d.version",
491 "modpacks.list%d.license",
494 "modpacks.list%d.type",
497 "modpacks.list%d.subtype",
518 if (
mpURL[0] ==
'.') {
bool has_capabilities(const char *us, const char *them)
static const char * download_modpack_recursive(const char *URL, const struct fcmp_params *fcmp, dl_msg_callback mcb, dl_pb_callback pbcb, int recursion)
const char * download_modpack(const char *URL, const struct fcmp_params *fcmp, dl_msg_callback mcb, dl_pb_callback pbcb)
static void nf_cb(const char *msg, void *data)
const char * download_modpack_list(const struct fcmp_params *fcmp, modpack_list_setup_cb cb, dl_msg_callback mcb)
void(* modpack_list_setup_cb)(const char *name, const char *URL, const char *version, const char *license, enum modpack_type type, const char *subtype, const char *notes)
void(* dl_msg_callback)(const char *msg)
void(* dl_pb_callback)(int downloaded, int max)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
const char * mpdb_installed_version(const char *name, enum modpack_type type)
bool mpdb_update_modpack(const char *name, enum modpack_type type, const char *version)
struct section_file * netfile_get_section_file(const char *URL, nf_errmsg cb, void *data)
bool netfile_download_file(const char *URL, const char *filename, nf_errmsg cb, void *data)
const char * section_name(const struct section *psection)
void secfile_destroy(struct section_file *secfile)
struct section_list * secfile_sections_by_name_prefix(const struct section_file *secfile, const char *prefix)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
bool make_dir_for_file(char *filename)
#define DIR_SEPARATOR_CHAR
static int recursion[AIT_LAST]
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_strcasecmp(const char *str0, const char *str1)
#define sz_strlcpy(dest, src)