From 8a056d9eb63290daa521cbe31bea88d10999ca9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD=E4=BA=91?= <71159641+littlewhitecloud@users.noreply.github.com> Date: Sat, 9 Dec 2023 18:06:38 +0800 Subject: [PATCH] emm --- src/output.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/output.c b/src/output.c index aa6f40ad..4b3421f5 100644 --- a/src/output.c +++ b/src/output.c @@ -7,6 +7,7 @@ #endif #include "jou_compiler.h" +#include #include #include #include @@ -103,6 +104,16 @@ static void mkdir_exist_ok(const char *p) exit(1); } +static void write_gitinore(const char *p) +{ + char *filename = malloc_sprintf("%s/.gitinore", p); + if (access(filename, F_OK)) + return; + FILE *gitinore = fopen(filename, "w"); + fprintf(gitinore, "*"); + fclose(gitinore); +} + static char *get_path_to_file_in_jou_compiled(const char *filename) { /* @@ -120,6 +131,7 @@ static char *get_path_to_file_in_jou_compiled(const char *filename) // path1 is known to exist mkdir_exist_ok(path2); + write_gitinore(path2); mkdir_exist_ok(path3); free(path1); free(path2);