diff options
Diffstat (limited to 'firmware/font.c')
-rw-r--r-- | firmware/font.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/firmware/font.c b/firmware/font.c index f1584713ed..b8ad76ec3a 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "panic.h" | 36 | #include "panic.h" |
37 | #include "rbunicode.h" | 37 | #include "rbunicode.h" |
38 | #include "diacritic.h" | 38 | #include "diacritic.h" |
39 | #include "rbpaths.h" | ||
39 | 40 | ||
40 | #define MAX_FONTSIZE_FOR_16_BIT_OFFSETS 0xFFDB | 41 | #define MAX_FONTSIZE_FOR_16_BIT_OFFSETS 0xFFDB |
41 | 42 | ||
@@ -56,7 +57,6 @@ | |||
56 | #define FONT_HEADER_SIZE 36 | 57 | #define FONT_HEADER_SIZE 36 |
57 | #endif | 58 | #endif |
58 | 59 | ||
59 | #define GLYPH_CACHE_FILE ROCKBOX_DIR"/.glyphcache" | ||
60 | 60 | ||
61 | #ifndef BOOTLOADER | 61 | #ifndef BOOTLOADER |
62 | /* Font cache includes */ | 62 | /* Font cache includes */ |
@@ -606,12 +606,13 @@ void glyph_cache_save(struct font* pf) | |||
606 | pf = &font_ui; | 606 | pf = &font_ui; |
607 | if (pf->fd >= 0 && pf == &font_ui) | 607 | if (pf->fd >= 0 && pf == &font_ui) |
608 | { | 608 | { |
609 | #ifdef WPSEDITOR | 609 | char path[MAX_PATH]; |
610 | cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666); | 610 | const char *file = get_user_file_path(GLYPH_CACHE_FILE, IS_FILE|NEED_WRITE, |
611 | #else | 611 | path, sizeof(path)); |
612 | cache_fd = creat(GLYPH_CACHE_FILE, 0666); | 612 | |
613 | #endif | 613 | cache_fd = open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
614 | if (cache_fd < 0) return; | 614 | if (cache_fd < 0) |
615 | return; | ||
615 | 616 | ||
616 | lru_traverse(&pf->cache._lru, glyph_file_write); | 617 | lru_traverse(&pf->cache._lru, glyph_file_write); |
617 | 618 | ||
@@ -630,9 +631,10 @@ static void glyph_cache_load(struct font* pf) | |||
630 | int fd; | 631 | int fd; |
631 | unsigned char tmp[2]; | 632 | unsigned char tmp[2]; |
632 | unsigned short ch; | 633 | unsigned short ch; |
634 | char path[MAX_PATH]; | ||
633 | 635 | ||
634 | fd = open(GLYPH_CACHE_FILE, O_RDONLY|O_BINARY); | 636 | fd = open(get_user_file_path(GLYPH_CACHE_FILE, IS_FILE|NEED_WRITE, |
635 | 637 | path, sizeof(path)), O_RDONLY|O_BINARY); | |
636 | if (fd >= 0) { | 638 | if (fd >= 0) { |
637 | 639 | ||
638 | while (read(fd, tmp, 2) == 2) { | 640 | while (read(fd, tmp, 2) == 2) { |