indent
This commit is contained in:
parent
060c13a068
commit
a05035089a
1
Makefile
1
Makefile
@ -13,3 +13,4 @@ make-libs-list:
|
||||
|
||||
clean:
|
||||
rm make-libs-list
|
||||
rm conanbuild* conaninfo.txt graph_info.json
|
||||
|
@ -14,14 +14,12 @@ void usage();
|
||||
void info(cJSON * json);
|
||||
void generate_library_list(cJSON * input_json, cJSON * output_json, char output_system);
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
int
|
||||
main(int argc, char const * argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
usage();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
FILE *fp;
|
||||
char str[900000];
|
||||
char buffer[100];
|
||||
@ -41,8 +39,7 @@ int main(int argc, char const *argv[])
|
||||
generate_library_list(json, launcher_libraries, argv[2][0]);
|
||||
int libraries_array_size = cJSON_GetArraySize(libraries);
|
||||
|
||||
switch (argv[2][0])
|
||||
{
|
||||
switch (argv[2][0]) {
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@ -50,8 +47,7 @@ int main(int argc, char const *argv[])
|
||||
info(json);
|
||||
break;
|
||||
case 'w':
|
||||
for (int i = 0; i < libraries_array_size; ++i)
|
||||
{
|
||||
for (int i = 0; i < libraries_array_size; ++i) {
|
||||
cJSON *library = cJSON_GetArrayItem(libraries, i);
|
||||
printf("%%MC_DIR%%/libraries/%s;", cJSON_GetStringValue(library));
|
||||
}
|
||||
@ -59,8 +55,7 @@ int main(int argc, char const *argv[])
|
||||
break;
|
||||
case 'l':
|
||||
case 'x':
|
||||
for (int i = 0; i < libraries_array_size; ++i)
|
||||
{
|
||||
for (int i = 0; i < libraries_array_size; ++i) {
|
||||
cJSON *library = cJSON_GetArrayItem(libraries, i);
|
||||
printf("$MC_DIR/libraries/%s:", cJSON_GetStringValue(library));
|
||||
}
|
||||
@ -72,7 +67,8 @@ int main(int argc, char const *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
void usage()
|
||||
void
|
||||
usage()
|
||||
{
|
||||
printf("%s\n%s: %s\n\n", "Minecraft Libraries List Generator",
|
||||
"Version", VERSION);
|
||||
@ -83,7 +79,8 @@ void usage()
|
||||
printf(" %s\n", "make-libs-string <version.json> i - to get version info");
|
||||
}
|
||||
|
||||
void info(cJSON *json)
|
||||
void
|
||||
info(cJSON * json)
|
||||
{
|
||||
char *minecraft_version = cJSON_GetStringValue(cJSON_GetObjectItem(json, "id"));
|
||||
printf("Minecraft Version: %s\n", minecraft_version);
|
||||
@ -96,7 +93,8 @@ void info(cJSON *json)
|
||||
printf("Minecraft libraries count: %d\n", libraries_array_size);
|
||||
}
|
||||
|
||||
void generate_library_list(cJSON *input_json, cJSON *output_json, char output_system)
|
||||
void
|
||||
generate_library_list(cJSON * input_json, cJSON * output_json, char output_system)
|
||||
{
|
||||
cJSON *input_libraries = cJSON_GetObjectItem(input_json, "libraries");
|
||||
cJSON *output_libraries = cJSON_GetObjectItem(output_json, "libraries");
|
||||
@ -104,8 +102,7 @@ void generate_library_list(cJSON *input_json, cJSON *output_json, char output_sy
|
||||
|
||||
char *output_system_name;
|
||||
|
||||
switch (output_system)
|
||||
{
|
||||
switch (output_system) {
|
||||
case 'w':
|
||||
output_system_name = "windows";
|
||||
break;
|
||||
@ -117,12 +114,10 @@ void generate_library_list(cJSON *input_json, cJSON *output_json, char output_sy
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < libraries_array_size; i++)
|
||||
{
|
||||
for (int i = 0; i < libraries_array_size; i++) {
|
||||
cJSON *library = cJSON_GetArrayItem(input_libraries, i);
|
||||
|
||||
if (library != NULL)
|
||||
{
|
||||
if (library != NULL) {
|
||||
cJSON *downloads = cJSON_GetObjectItem(library, "downloads");
|
||||
cJSON *artifact = cJSON_GetObjectItem(downloads, "artifact");
|
||||
|
||||
@ -137,8 +132,7 @@ void generate_library_list(cJSON *input_json, cJSON *output_json, char output_sy
|
||||
if (strcmp(output_system_name, os_name) == 0) {
|
||||
cJSON_AddItemToArray(output_libraries, cJSON_CreateString(library_path));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
char *library_path = cJSON_GetStringValue(cJSON_GetObjectItem(artifact, "path"));
|
||||
cJSON_AddItemToArray(output_libraries, cJSON_CreateString(library_path));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user