Add .gitigore generation and fix printfs in load_manifest.
This commit is contained in:
parent
4c84be1312
commit
76f022e7ea
18
main.c
18
main.c
@ -227,31 +227,31 @@ project_manifest* load_manifest(char const *path) {
|
||||
toml_table_t *conf = toml_parse_file(fp, errbuf, sizeof(errbuf));
|
||||
fclose(fp);
|
||||
if (!conf) {
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot parse file.\n", errbuf);
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot parse file: %s\n", errbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toml_table_t *general = toml_table_in(conf, "General");
|
||||
if (!general) {
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find [General] table.\n", errbuf);
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find [General] table.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toml_datum_t name = toml_string_in(general, "Name");
|
||||
if (!name.ok) {
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Name field.\n", errbuf);
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Name field.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toml_datum_t author = toml_string_in(general, "Author");
|
||||
if (!author.ok) {
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Author field.\n", errbuf);
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Author field.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
toml_datum_t version = toml_string_in(general, "Version");
|
||||
if (!version.ok) {
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Version field.\n", errbuf);
|
||||
fprintf(stderr, "Error: Cannot load manifest file: Cannot find Version field.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -626,6 +626,14 @@ int main(int argc, char **argv) {
|
||||
|
||||
create_manifest_file(project_path);
|
||||
|
||||
FILE *fp = fopen(text_format("%s/.gitignore", project_path), "w+");
|
||||
if (fp) {
|
||||
fputs("build\nout\n", fp);
|
||||
fclose(fp);
|
||||
} else {
|
||||
fputs("Warning: Cannot open .gitignore!\n", stderr);
|
||||
}
|
||||
|
||||
if (can_run_command("git"))
|
||||
system(text_format("git init %s", project_path));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user