From ca7a3b138ed70d67ceb3a9033f4feb4c8acca4cc Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sat, 30 Sep 2023 13:23:27 +0200 Subject: Set default project file: last --- source/saw/main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/source/saw/main.c b/source/saw/main.c index d8f0aa6..43c9f3f 100644 --- a/source/saw/main.c +++ b/source/saw/main.c @@ -1303,9 +1303,6 @@ static void saw_init(void) { // if (saw_project_file.size == 0) { - char abc[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY" - "Z0123456789"; - char arena_buf[10000]; kit_allocator_t arena = kit_alloc_buffer(sizeof arena_buf, arena_buf); @@ -1320,22 +1317,12 @@ static void saw_init(void) { printf("Failed to create cache folder: %s\n (code %d)", BS(cache), (i32) s); else { - for (i32 index = 0;; ++index) { - memcpy(saw_project_file_buf, cache.values, cache.size); - saw_project_file_buf[cache.size] = PATH_DELIM_C; - - for (i32 i = 0; i < 16; i++) - saw_project_file_buf[cache.size + 1 + i] = - abc[mt64_generate(&saw_mt64) % (sizeof abc - 1)]; - - sprintf(saw_project_file_buf + cache.size + 17, "%d", index); + memcpy(saw_project_file_buf, cache.values, cache.size); + saw_project_file_buf[cache.size] = PATH_DELIM_C; + memcpy(saw_project_file_buf + cache.size + 1, "last", 5); - saw_project_file.size = strlen(saw_project_file_buf); - saw_project_file.values = saw_project_file_buf; - - if (path_type(saw_project_file) == PATH_NONE) - break; - } + saw_project_file.size = strlen(saw_project_file_buf); + saw_project_file.values = saw_project_file_buf; printf("Project file: %s\n", saw_project_file_buf); } -- cgit v1.2.3