MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / EntryList_Save

Function EntryList_Save

src/Utils.c:296–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void EntryList_Save(struct StringsBuffer* list, const char* file) {
297 cc_string path, entry; char pathBuffer[FILENAME_SIZE];
298 struct Stream stream;
299 cc_filepath raw_path;
300 cc_result res;
301 int i;
302
303 String_InitArray(path, pathBuffer);
304 String_AppendConst(&path, file);
305
306 Platform_EncodePath(&raw_path, &path);
307 res = Stream_CreatePath(&stream, &raw_path);
308 if (res) { Logger_IOWarn2(res, "creating", &raw_path); return; }
309
310 for (i = 0; i < list->count; i++) {
311 StringsBuffer_UNSAFE_GetRaw(list, i, &entry);
312 res = Stream_WriteLine(&stream, &entry);
313 if (res) { Logger_IOWarn2(res, "writing to", &raw_path); break; }
314 }
315
316 res = stream.Close(&stream);
317 if (res) { Logger_IOWarn2(res, "closing", &raw_path); }
318}
319
320cc_bool EntryList_Remove(struct StringsBuffer* list, const cc_string* key, char separator) {
321 cc_bool found = false;

Callers 6

TextureUrls_AcceptFunction · 0.85
TextureUrls_DenyFunction · 0.85
TextureUrls_ClearDeniedFunction · 0.85
SetCachedTagFunction · 0.85
SysFonts_SaveCacheFunction · 0.85
SaveOptionsFunction · 0.85

Calls 6

String_AppendConstFunction · 0.85
Stream_CreatePathFunction · 0.85
Logger_IOWarn2Function · 0.85
Stream_WriteLineFunction · 0.85
Platform_EncodePathFunction · 0.70

Tested by

no test coverage detected