| 54 | } |
| 55 | |
| 56 | static void write_file_at(const char *rel_path, const char *content) { |
| 57 | char path[512]; |
| 58 | snprintf(path, sizeof(path), "%s/%s", g_repodir, rel_path); |
| 59 | char dir[512]; |
| 60 | snprintf(dir, sizeof(dir), "%s", path); |
| 61 | char *slash = strrchr(dir, '/'); |
| 62 | if (slash) { |
| 63 | *slash = '\0'; |
| 64 | cbm_mkdir(dir); |
| 65 | } |
| 66 | FILE *f = fopen(path, "w"); |
| 67 | if (f) { |
| 68 | fputs(content, f); |
| 69 | fclose(f); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | static void delete_file_at(const char *rel_path) { |
| 74 | char path[512]; |