jag

snake_c

public

Small snake game in C

Star0
Watch0

Commit b806cbd5647f

tarball

Jaglekon <58274093+Jaglekon@users.noreply.github.com>2026-03-31 20:43 UTC

2 files changed+8-4
no XDG_DATA_HOME fix ver 3
Modified file: snake.c+5 additions−3 deletions
@@ -43,15 +43,17 @@ int main(int argc, char *args[]) {
4343 printf("are you ok?\n");
4444 return 1;
4545 }
46-
46+
47+ errno = 0;
4748 snprintf(file_path, sizeof(file_path), "%s/.local", env);
48- if (mkdir(file_path, 0755)) {
49+ if (mkdir(file_path, 0755) && errno != EEXIST) {
4950 printf("couldn't create folder");
5051 return 1;
5152 }
5253
54+ errno = 0;
5355 snprintf(file_path, sizeof(file_path), "%s/.local/share", env);
54- if (mkdir(file_path, 0755)) {
56+ if (mkdir(file_path, 0755) && errno != EEXIST) {
5557 printf("couldn't create folder");
5658 return 1;
5759 }
Modified file: snake.h+3 additions−1 deletions
@@ -13,7 +13,9 @@
1313 #include <stdlib.h>
1414
1515 #include <sys/ioctl.h>
16- #include <sys/stat.h>
16+#include <sys/stat.h>
17+
18+#include <errno.h>
1719
1820 #include <time.h>