Compare commits

...

5 Commits

Author SHA1 Message Date
Alexander Popov 870ec13a2b
add \n for output 2022-08-28 22:18:46 +03:00
Alexander Popov 818065e4e3
English guide 2022-08-28 22:16:52 +03:00
Alexander Popov 8164936b7f
Russian guide 2022-08-28 22:09:37 +03:00
Alexander Popov 1ebb56d321
add version const 2022-08-28 22:09:02 +03:00
Alexander Popov 0ddf1ef1d7
use Conan PM 2022-08-28 21:58:39 +03:00
5 changed files with 94 additions and 5 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
conan.lock
conanbuild*
conaninfo.txt
graph_info.json

View File

@ -1,3 +1,5 @@
include conanbuildinfo.mak
CC = clang
CFLAGS = -O2
LIBS = -lcjson
@ -5,7 +7,9 @@ LIBS = -lcjson
all: make-libs-list
make-libs-list:
$(CC) $(CFLAGS) make-libs-list.c $(LIBS) -o $@
$(CC) $(CFLAGS) make-libs-list.c \
$(LIBS) -I$(CONAN_INCLUDE_DIRS_CJSON) -L$(CONAN_LIB_DIRS_CJSON) \
-o $@
clean:
rm make-libs-list

View File

@ -1 +1,68 @@
Parse `version.json` file and return libs
# Parse `version.json` file and return libs
## English
**About:**
Utility parse Minecraft JE game version file (`version.json`) and returns
libraries list for specified operation system.
**How to use:**
```
Minecraft Libraries List Generator
Usage:
make-libs-string <version.json> <system>
<system> - w|l|x (windows or linux or osx)
Other:
make-libs-string <version.json> s - to get info
```
Utility has two required arguments,
`<version.json>` and `<system>`.
* `version.json` - takes the path to the file.
* `system` - takes one of three values `w` `l` `x`, the letter of which corresponds to one of the operating systems.
_**version.json**_ example for 1.19.2 version.
```sh
wget https://piston-meta.mojang.com/v1/packages/68cded4616fba9fbefb3f895033c261126c5f89c/1.19.2.json
```
## Русский
**Описание:**
Утилита парсит файл версий (`version.json`) Minecraft JE и возвращает
список библиотек для указанной операционной системы.
**Как использовать:**
```
Minecraft Libraries List Generator
Usage:
make-libs-string <version.json> <system>
<system> - w|l|x (windows or linux or osx)
Other:
make-libs-string <version.json> s - to get info
```
Программа имеет два обязательных аргумента,
`<version.json>` и `<system>`.
* `version.json` - принимает путь к файлу
* `system` - принимает одно из трёх значений `w` `l` `x`, буква которых соответствует одной из операционных систем.
Пример _**version.json**_ для версии 1.19.2.
```sh
wget https://piston-meta.mojang.com/v1/packages/68cded4616fba9fbefb3f895033c261126c5f89c/1.19.2.json
```

5
conanfile.txt Normal file
View File

@ -0,0 +1,5 @@
[requires]
cjson/1.7.15
[generators]
make

View File

@ -1,7 +1,15 @@
/*
AUTHOR: Alexander Popov <iiiypuk {at} fastmail.fm>
LICENSE: MIT-0
REPO: https://git.a2s.su/iiiypuk/minecraft-launcher-libs
*/
#include <stdio.h>
#include <string.h>
#include <cjson/cJSON.h>
#define VERSION "1.0.0" // software version
void usage();
void info(cJSON *json);
void generate_library_list(cJSON *input_json, cJSON *output_json, char output_system);
@ -47,7 +55,7 @@ int main(int argc, char const *argv[])
cJSON *library = cJSON_GetArrayItem(libraries, i);
printf("%%MC_DIR%%/libraries/%s;", cJSON_GetStringValue(library));
}
printf("%s", "%MC_DIR%/versions/%GAME_VERSION%/%GAME_VERSION%.jar");
printf("%s\n", "%MC_DIR%/versions/%GAME_VERSION%/%GAME_VERSION%.jar");
break;
case 'l':
case 'x':
@ -56,7 +64,7 @@ int main(int argc, char const *argv[])
cJSON *library = cJSON_GetArrayItem(libraries, i);
printf("$MC_DIR/libraries/%s:", cJSON_GetStringValue(library));
}
printf("%s", "$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar");
printf("%s\n", "$MC_DIR/versions/$GAME_VERSION/$GAME_VERSION.jar");
break;
}
}
@ -66,7 +74,8 @@ int main(int argc, char const *argv[])
void usage()
{
printf("%s\n\n", "Minecraft Libraries List Generator");
printf("%s\n%s: %s\n\n", "Minecraft Libraries List Generator",
"Version", VERSION);
printf("%s\n", "Usage:");
printf(" %s\n\n", "make-libs-string <version.json> <system>");
printf(" %s\n\n", "<system> - w|l|x (windows or linux or osx)");