1 diff --git a/src/main.c b/src/main.c
2 index 993a76f..de5b2c5 100644
5 @@ -6,12 +6,8 @@ _Static_assert(sizeof(string_modes)/sizeof(*string_modes) == MODE_COUNT, "Number
6 char *get_help_page(char *page) {
7 if (page == NULL) return NULL;
9 - char *env = getenv("HOME");
10 - if(env == NULL) CRASH("could not get HOME");
12 - char *help_page = calloc(128, sizeof(char));
13 - if (help_page == NULL) CRASH("could not calloc memory for help page");
14 - snprintf(help_page, 128, "%s/.local/share/cano/help/%s", env, page);
16 + asprintf(&help_page, "@help@/%s", page);
18 // check if file exists
20 diff --git a/src/tools.c b/src/tools.c
21 index 220d7a1..4ce211e 100644
24 @@ -63,6 +63,9 @@ void free_undo_stack(Undo_Stack *undo) {
26 void handle_save(Buffer *buffer) {
27 FILE *file = fopen(buffer->filename, "w");
31 fwrite(buffer->data.data, buffer->data.count, sizeof(char), file);
34 @@ -72,7 +75,7 @@ Buffer *load_buffer_from_file(char *filename) {
35 size_t filename_s = strlen(filename)+1;
36 buffer->filename = calloc(filename_s, sizeof(char));
37 strncpy(buffer->filename, filename, filename_s);
38 - FILE *file = fopen(filename, "a+");
39 + FILE *file = fopen(filename, "r");
40 if(file == NULL) CRASH("Could not open file");
41 fseek(file, 0, SEEK_END);
42 size_t length = ftell(file);