summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-30 13:23:27 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-30 13:23:27 +0200
commitca7a3b138ed70d67ceb3a9033f4feb4c8acca4cc (patch)
tree72a749475da0ca6ca08dd6fa7b30c5c1eca2bf88
parent82eee593d157c08618b57fdf5358679c9389995e (diff)
downloadsaw-ca7a3b138ed70d67ceb3a9033f4feb4c8acca4cc.zip
Set default project file: last
-rw-r--r--source/saw/main.c23
1 files 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);
}