From 2c2416094f426972c9e2e96d25058311bbe82f97 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 6 Dec 2010 22:26:31 +0000 Subject: Get rid of get_user_file_path and do the path handling in wrappers for open() and friends. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657 --- apps/filetypes.c | 8 +- apps/gui/icon.c | 7 +- apps/gui/skin_engine/skin_backdrops.c | 14 +--- apps/gui/skin_engine/skin_engine.c | 6 +- apps/gui/skin_engine/skin_fonts.c | 4 +- apps/gui/skin_engine/skin_parser.c | 3 +- apps/main.c | 4 +- apps/menus/theme_menu.c | 4 +- apps/playlist.c | 10 +-- apps/playlist_catalog.c | 8 +- apps/plugin.c | 6 +- apps/settings.c | 36 +++------ apps/tagcache.c | 145 +++++++++++----------------------- apps/tree.c | 3 +- 14 files changed, 79 insertions(+), 179 deletions(-) (limited to 'apps') diff --git a/apps/filetypes.c b/apps/filetypes.c index f23026ea69..481c0df6de 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -219,15 +219,14 @@ static void read_config(const char* config_file); * load a colors file from a theme with: * filetype colours: filename.colours */ void read_color_theme_file(void) { - char buffer[MAX_PATH], dir[MAX_PATH]; + char buffer[MAX_PATH]; int fd; char *ext, *color; int i; for (i = 0; i < MAX_FILETYPES+1; i++) { custom_colors[i] = -1; } - snprintf(buffer, MAX_PATH, "%s/%s.colours", - get_user_file_path(THEME_DIR, 0, dir, sizeof(dir)), + snprintf(buffer, MAX_PATH, THEME_DIR "/%s.colours", global_settings.colors_file); fd = open(buffer, O_RDONLY); if (fd < 0) @@ -300,7 +299,6 @@ void read_viewer_theme_file(void) void filetype_init(void) { - char path[MAX_PATH]; /* set the directory item first */ filetypes[0].extension = NULL; filetypes[0].plugin = NULL; @@ -310,7 +308,7 @@ void filetype_init(void) viewer_count = 0; filetype_count = 1; read_builtin_types(); - read_config(get_user_file_path(VIEWERS_CONFIG, IS_FILE, path, sizeof(path))); + read_config(VIEWERS_CONFIG); #ifdef HAVE_LCD_BITMAP read_viewer_theme_file(); #endif diff --git a/apps/gui/icon.c b/apps/gui/icon.c index c4581e031f..628196a98f 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c @@ -228,12 +228,9 @@ static void load_icons(const char* filename, enum Iconset iconset) if (filename[0] && filename[0] != '-') { char path[MAX_PATH]; - char temp[MAX_PATH]; - const char * fname; - snprintf(path, sizeof(path), "%s/%s.bmp", ICON_DIR, filename); - fname = get_user_file_path(path, IS_FILE, temp, sizeof(temp)); - size_read = read_bmp_file(fname, bmp, IMG_BUFSIZE, bmpformat, NULL); + snprintf(path, sizeof(path), ICON_DIR "/%s.bmp", filename); + size_read = read_bmp_file(path, bmp, IMG_BUFSIZE, bmpformat, NULL); if (size_read > 0) { *loaded_ok = true; diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c index e337774994..3e04beaae0 100644 --- a/apps/gui/skin_engine/skin_backdrops.c +++ b/apps/gui/skin_engine/skin_backdrops.c @@ -54,7 +54,6 @@ void skin_backdrop_init(void) int skin_backdrop_assign(char* backdrop, char *bmpdir, enum screen_type screen) { - char dir[MAX_PATH]; char filename[MAX_PATH]; int i, free = -1; if (!backdrop) @@ -68,8 +67,7 @@ int skin_backdrop_assign(char* backdrop, char *bmpdir, } else { - const char *bd_dir = get_user_file_path(bmpdir, 0, dir, sizeof(dir)); - get_image_filename(backdrop, bd_dir, filename, sizeof(filename)); + get_image_filename(backdrop, bmpdir, filename, sizeof(filename)); } for (i=0; idir, 0, path, sizeof(path)), - info->show_options); + return rockbox_browse(info->dir, info->show_options); } #ifdef HAVE_LCD_BITMAP diff --git a/apps/playlist.c b/apps/playlist.c index f56603749a..41d6ae5ed7 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1439,12 +1439,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) /* process random folder advance */ if (global_settings.next_folder == FOLDER_ADVANCE_RANDOM) { - char folder_advance_list[MAX_PATH]; - get_user_file_path(ROCKBOX_DIR, FORCE_BUFFER_COPY, - folder_advance_list, sizeof(folder_advance_list)); - strlcat(folder_advance_list, "/folder_advance_list.dat", - sizeof(folder_advance_list)); - int fd = open(folder_advance_list, O_RDONLY); + int fd = open(ROCKBOX_DIR "/folder_advance_list.dat", O_RDONLY); if (fd >= 0) { char buffer[MAX_PATH]; @@ -1914,8 +1909,7 @@ void playlist_init(void) struct playlist_info* playlist = ¤t_playlist; playlist->current = true; - get_user_file_path(PLAYLIST_CONTROL_FILE, IS_FILE|NEED_WRITE|FORCE_BUFFER_COPY, - playlist->control_filename, + strlcpy(playlist->control_filename, PLAYLIST_CONTROL_FILE, sizeof(playlist->control_filename)); playlist->fd = -1; playlist->control_fd = -1; diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 5f9f46728a..ff69b28263 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -81,11 +81,9 @@ static int initialize_catalog(void) /* fall back to default directory if no or invalid config */ if (default_dir) { - const char *dir = get_user_file_path(PLAYLIST_CATALOG_DEFAULT_DIR, - FORCE_BUFFER_COPY|NEED_WRITE, - playlist_dir, sizeof(playlist_dir)); - if (!dir_exists(dir)) - mkdir(dir); + strcpy(playlist_dir, PLAYLIST_CATALOG_DEFAULT_DIR); + if (!dir_exists(playlist_dir)) + mkdir(playlist_dir); } playlist_dir_length = strlen(playlist_dir); diff --git a/apps/plugin.c b/apps/plugin.c index 316c7c6b5d..f28593ec4e 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -314,11 +314,11 @@ static const struct plugin_api rockbox_api = { #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE (creat_func)creat_wrapper, #else - (creat_func)PREFIX(creat), + (creat_func)creat, #endif (write_func)PREFIX(write), - PREFIX(remove), - PREFIX(rename), + remove, + rename, PREFIX(ftruncate), PREFIX(filesize), fdprintf, diff --git a/apps/settings.c b/apps/settings.c index 85b0489c09..848c7c14f2 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -118,9 +118,7 @@ static bool read_nvram_data(char* buf, int max_len) unsigned crc32 = 0xffffffff; int var_count = 0, i = 0, buf_pos = 0; #ifndef HAVE_RTC_RAM - char path[MAX_PATH]; - int fd = open(get_user_file_path(NVRAM_FILE, IS_FILE|NEED_WRITE, - path, sizeof(path)), O_RDONLY); + int fd = open(NVRAM_FILE, O_RDONLY); int bytes; if (fd < 0) return false; @@ -174,7 +172,6 @@ static bool write_nvram_data(char* buf, int max_len) char var_count = 0; #ifndef HAVE_RTC_RAM int fd; - char path[MAX_PATH]; #endif memset(buf,0,max_len); /* magic, version */ @@ -198,8 +195,7 @@ static bool write_nvram_data(char* buf, int max_len) max_len-NVRAM_DATA_START-1,0xffffffff); memcpy(&buf[4],&crc32,4); #ifndef HAVE_RTC_RAM - fd = open(get_user_file_path(NVRAM_FILE, IS_FILE|NEED_WRITE, - path, sizeof(path)),O_CREAT|O_TRUNC|O_WRONLY, 0666); + fd = open(NVRAM_FILE,O_CREAT|O_TRUNC|O_WRONLY, 0666); if (fd >= 0) { int len = write(fd,buf,max_len); @@ -230,12 +226,8 @@ void settings_load(int which) read_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); if (which&SETTINGS_HD) { - const char *file; - char path[MAX_PATH]; - file = get_user_file_path(CONFIGFILE, IS_FILE|NEED_WRITE, path, sizeof(path)); - settings_load_config(file, false); - file = get_user_file_path(FIXEDSETTINGSFILE, IS_FILE, path, sizeof(path)); - settings_load_config(file, false); + settings_load_config(CONFIGFILE, false); + settings_load_config(FIXEDSETTINGSFILE, false); } } @@ -596,11 +588,8 @@ static void flush_global_status_callback(void *data) static void flush_config_block_callback(void *data) { (void)data; - char path[MAX_PATH]; write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); - settings_write_config( - get_user_file_path(CONFIGFILE, IS_FILE|NEED_WRITE, path, sizeof(path)), - SETTINGS_SAVE_CHANGED); + settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED); } /* @@ -644,7 +633,7 @@ int settings_save(void) bool settings_save_config(int options) { - char filename[MAX_PATH], path[MAX_PATH]; + char filename[MAX_PATH]; const char *folder, *namebase; switch (options) { @@ -673,8 +662,6 @@ bool settings_save_config(int options) namebase = "config"; break; } - - folder = get_user_file_path(folder, NEED_WRITE, path, sizeof(path)); create_numbered_filename(filename, folder, namebase, ".cfg", 2 IF_CNFN_NUM_(, NULL)); @@ -884,13 +871,11 @@ void settings_apply(bool read_disk) { char buf[MAX_PATH]; #ifdef HAVE_LCD_BITMAP - char dir[MAX_PATH]; - const char *font_path = get_user_file_path(FONT_DIR, 0, dir, sizeof(dir)); /* fonts need to be loaded before the WPS */ if (global_settings.font_file[0] && global_settings.font_file[0] != '-') { - snprintf(buf, sizeof buf, "%s/%s.fnt", font_path, + snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", global_settings.font_file); CHART2(">font_load ", global_settings.font_file); rc = font_load(NULL, buf); @@ -903,7 +888,7 @@ void settings_apply(bool read_disk) #ifdef HAVE_REMOTE_LCD if ( global_settings.remote_font_file[0] && global_settings.remote_font_file[0] != '-') { - snprintf(buf, sizeof buf, "%s/%s.fnt", font_path, + snprintf(buf, sizeof buf, FONT_DIR "%s.fnt", global_settings.remote_font_file); CHART2(">font_load_remoteui ", global_settings.remote_font_file); rc = font_load_remoteui(buf); @@ -915,8 +900,7 @@ void settings_apply(bool read_disk) font_load_remoteui(NULL); #endif if ( global_settings.kbd_file[0]) { - snprintf(buf, sizeof buf, "%s/%s.kbd", - get_user_file_path(ROCKBOX_DIR, 0, dir, sizeof(dir)), + snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", global_settings.kbd_file); CHART(">load_kbd"); load_kbd(buf); @@ -925,8 +909,6 @@ void settings_apply(bool read_disk) else load_kbd(NULL); #endif /* HAVE_LCD_BITMAP */ - /* no get_user_file_path() here because we don't really support - * langs that don't come with rockbox */ if ( global_settings.lang_file[0]) { snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", global_settings.lang_file); diff --git a/apps/tagcache.c b/apps/tagcache.c index 679d7cbe79..5b175c4b20 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -73,9 +73,9 @@ #include "buffer.h" #include "crc32.h" #include "misc.h" -#include "filefuncs.h" #include "settings.h" #include "dir.h" +#include "filefuncs.h" #include "structec.h" #ifndef __PCTOOL__ @@ -293,17 +293,15 @@ static bool is_dircache_intact(void) static int open_tag_fd(struct tagcache_header *hdr, int tag, bool write) { int fd; - char buf[MAX_PATH], path[MAX_PATH]; - const char * file; + char buf[MAX_PATH]; int rc; if (TAGCACHE_IS_NUMERIC(tag) || tag < 0 || tag >= TAG_COUNT) return -1; snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, tag); - file = get_user_file_path(buf, IS_FILE | NEED_WRITE, path, sizeof(path)); - fd = open(file, write ? O_RDWR : O_RDONLY); + fd = open(buf, write ? O_RDWR : O_RDONLY); if (fd < 0) { logf("tag file open failed: tag=%d write=%d file=%s", tag, write, buf); @@ -328,12 +326,8 @@ static int open_master_fd(struct master_header *hdr, bool write) { int fd; int rc; - char path[MAX_PATH]; - fd = open(get_user_file_path(TAGCACHE_FILE_MASTER, - IS_FILE|NEED_WRITE, - path, sizeof(path)), - write ? O_RDWR : O_RDONLY); + fd = open(TAGCACHE_FILE_MASTER, write ? O_RDWR : O_RDONLY); if (fd < 0) { logf("master file open failed for R/W"); @@ -675,12 +669,10 @@ static bool open_files(struct tagcache_search *tcs, int tag) { if (tcs->idxfd[tag] < 0) { - char fn[MAX_PATH], path[MAX_PATH]; - const char *file; + char fn[MAX_PATH]; snprintf(fn, sizeof fn, TAGCACHE_FILE_INDEX, tag); - file = get_user_file_path(fn, IS_FILE | NEED_WRITE, path, sizeof(path)); - tcs->idxfd[tag] = open(file, O_RDONLY); + tcs->idxfd[tag] = open(fn, O_RDONLY); } if (tcs->idxfd[tag] < 0) @@ -1218,17 +1210,14 @@ static void remove_files(void) tc_stat.ready = false; tc_stat.ramcache = false; tc_stat.econ = false; - remove(get_user_file_path(TAGCACHE_FILE_MASTER, NEED_WRITE|IS_FILE, - buf, sizeof(buf))); + remove(TAGCACHE_FILE_MASTER); for (i = 0; i < TAG_COUNT; i++) { - char buf2[MAX_PATH]; if (TAGCACHE_IS_NUMERIC(i)) continue; - - /* database_%d.tcd -> database_0.tcd */ + snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, i); - remove(get_user_file_path(buf, NEED_WRITE | IS_FILE, buf2, sizeof(buf2))); + remove(buf); } } @@ -1379,11 +1368,10 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs, if (!TAGCACHE_IS_NUMERIC(clause->tag) && tcs->idxfd[clause->tag] < 0) { - char buf[MAX_PATH], path[MAX_PATH]; - const char *file; - snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, clause->tag); - file = get_user_file_path(buf, IS_FILE | NEED_WRITE, path, sizeof(path)); - tcs->idxfd[clause->tag] = open(file, O_RDONLY); + char buf[MAX_PATH]; + + snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, clause->tag); + tcs->idxfd[clause->tag] = open(buf, O_RDONLY); } tcs->clause[tcs->clause_count] = clause; @@ -2407,8 +2395,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) struct master_header tcmh; struct index_entry idxbuf[IDX_BUF_DEPTH]; int idxbuf_pos; - char buf[TAG_MAXLEN+32], path[MAX_PATH]; - const char *file; + char buf[TAG_MAXLEN+32]; int fd = -1, masterfd; bool error = false; int init; @@ -2556,8 +2543,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) * anything whether the index type is sorted or not. */ snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, index_type); - file = get_user_file_path(buf, IS_FILE | NEED_WRITE, path, sizeof(path)); - fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) { logf("%s open fail", buf); @@ -2577,21 +2563,18 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) } } - file = get_user_file_path(TAGCACHE_FILE_MASTER, - IS_FILE|NEED_WRITE, - buf, sizeof(buf)); /* Loading the tag lookup file as "master file". */ logf("Loading index file"); - masterfd = open(file, O_RDWR); + masterfd = open(TAGCACHE_FILE_MASTER, O_RDWR); if (masterfd < 0) { logf("Creating new DB"); - masterfd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + masterfd = open(TAGCACHE_FILE_MASTER, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (masterfd < 0) { - logf("Failure to create index file (%s)", file); + logf("Failure to create index file (%s)", TAGCACHE_FILE_MASTER); close(fd); return -2; } @@ -2899,8 +2882,6 @@ static bool commit(void) { struct tagcache_header tch; struct master_header tcmh; - char path[MAX_PATH]; - const char *file; int i, len, rc; int tmpfd; int masterfd; @@ -2914,10 +2895,7 @@ static bool commit(void) while (write_lock) sleep(1); - file = get_user_file_path(TAGCACHE_FILE_TEMP, - IS_FILE|NEED_WRITE, path, sizeof(path)); - - tmpfd = open(file, O_RDONLY); + tmpfd = open(TAGCACHE_FILE_TEMP, O_RDONLY); if (tmpfd < 0) { logf("nothing to commit"); @@ -2933,7 +2911,7 @@ static bool commit(void) { logf("incorrect tmpheader"); close(tmpfd); - remove(file); + remove(TAGCACHE_FILE_TEMP); return false; } @@ -2941,7 +2919,7 @@ static bool commit(void) { logf("nothing to commit"); close(tmpfd); - remove(file); + remove(TAGCACHE_FILE_TEMP); return true; } @@ -2949,8 +2927,7 @@ static bool commit(void) tc_stat.ready = check_all_headers(); #ifdef HAVE_EEPROM_SETTINGS - remove(get_user_file_path(TAGCACHE_STATEFILE, IS_FILE | NEED_WRITE, - path, sizeof(path))); + remove(TAGCACHE_STATEFILE); #endif /* At first be sure to unload the ramcache! */ @@ -3040,7 +3017,7 @@ static bool commit(void) } close(tmpfd); - remove(file); + remove(TAGCACHE_FILE_TEMP); tc_stat.commit_step = 0; @@ -3458,18 +3435,15 @@ bool tagcache_import_changelog(void) struct tagcache_header tch; int clfd; long masterfd; - char buf[MAX(MAX_PATH, 2048)]; - const char *file; + char buf[2048]; if (!tc_stat.ready) return false; while (read_lock) sleep(1); - - file = get_user_file_path(TAGCACHE_FILE_CHANGELOG, - IS_FILE|NEED_WRITE, buf, sizeof(buf)); - clfd = open(file, O_RDONLY); + + clfd = open(TAGCACHE_FILE_CHANGELOG, O_RDONLY); if (clfd < 0) { logf("failure to open changelog"); @@ -3511,8 +3485,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) { struct master_header myhdr; struct index_entry idx; - const char *file; - char buf[MAX(TAG_MAXLEN+32, MAX_PATH)]; + char buf[TAG_MAXLEN+32]; char temp[32]; int clfd; int i, j; @@ -3524,9 +3497,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) return false; /* Initialize the changelog */ - file = get_user_file_path(TAGCACHE_FILE_CHANGELOG, IS_FILE | NEED_WRITE, - buf, sizeof(buf)); - clfd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + clfd = open(TAGCACHE_FILE_CHANGELOG, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (clfd < 0) { logf("failure to open changelog"); @@ -3844,15 +3815,11 @@ static bool allocate_tagcache(void) static bool tagcache_dumpload(void) { struct statefile_header shdr; - char path[MAX_PATH]; - const char *file; int fd, rc; long offpos; int i; - - file = get_user_file_path(TAGCACHE_STATEFILE, IS_FILE | NEED_WRITE, - path, sizeof(path)); - fd = open(file, O_RDONLY); + + fd = open(TAGCACHE_STATEFILE, O_RDONLY); if (fd < 0) { logf("no tagcache statedump"); @@ -3898,16 +3865,12 @@ static bool tagcache_dumpload(void) static bool tagcache_dumpsave(void) { struct statefile_header shdr; - char path[MAX_PATH]; - const char *file; int fd; if (!tc_stat.ramcache) return false; - file = get_user_file_path(TAGCACHE_STATEFILE, IS_FILE | NEED_WRITE, - path, sizeof(path)); - fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(TAGCACHE_STATEFILE, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) { logf("failed to create a statedump"); @@ -3933,8 +3896,7 @@ static bool load_tagcache(void) long bytesleft = tc_stat.ramcache_allocated; struct index_entry *idx; int rc, fd; - char *p, path[MAX_PATH]; - const char *file; + char *p; int i, tag; # ifdef HAVE_DIRCACHE @@ -3945,11 +3907,8 @@ static bool load_tagcache(void) # endif logf("loading tagcache to ram..."); - - file = get_user_file_path(TAGCACHE_FILE_MASTER, - IS_FILE|NEED_WRITE, - path, sizeof(path)); - fd = open(file, O_RDONLY); + + fd = open(TAGCACHE_FILE_MASTER, O_RDONLY); if (fd < 0) { logf("tagcache open failed"); @@ -4159,14 +4118,12 @@ static bool load_tagcache(void) static bool check_deleted_files(void) { int fd; - char buf[TAG_MAXLEN+32], path[MAX_PATH]; - const char *file; + char buf[TAG_MAXLEN+32]; struct tagfile_entry tfe; logf("reverse scan..."); snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, tag_filename); - file = get_user_file_path(buf, IS_FILE | NEED_WRITE, path, sizeof(path)); - fd = open(file, O_RDONLY); + fd = open(buf, O_RDONLY); if (fd < 0) { @@ -4326,8 +4283,6 @@ void tagcache_build(const char *path) { struct tagcache_header header; bool ret; - char buf[MAX_PATH]; - const char *file; curpath[0] = '\0'; data_size = 0; @@ -4340,21 +4295,19 @@ void tagcache_build(const char *path) #endif logf("updating tagcache"); - - file = get_user_file_path(TAGCACHE_FILE_TEMP, - IS_FILE|NEED_WRITE, buf, sizeof(buf)); - - if (file_exists(file)) + cachefd = open(TAGCACHE_FILE_TEMP, O_RDONLY); + if (cachefd >= 0) { logf("skipping, cache already waiting for commit"); + close(cachefd); return ; } - cachefd = open(file, O_RDWR | O_CREAT | O_TRUNC, 0666); + cachefd = open(TAGCACHE_FILE_TEMP, O_RDWR | O_CREAT | O_TRUNC, 0666); if (cachefd < 0) { - logf("master file open failed: %s", file); + logf("master file open failed: %s", TAGCACHE_FILE_TEMP); return ; } @@ -4398,7 +4351,7 @@ void tagcache_build(const char *path) #endif if (commit()) { - remove(file); + remove(TAGCACHE_FILE_TEMP); logf("tagcache built!"); } #ifdef __PCTOOL__ @@ -4443,12 +4396,7 @@ void tagcache_unload_ramcache(void) { tc_stat.ramcache = false; /* Just to make sure there is no statefile present. */ - -#if 0 - char path[MAX_PATH]; - remove(get_user_file_path(TAGCACHE_STATEFILE, IS_FILE | NEED_WRITE, - path, sizeof(path))); -#endif + // remove(TAGCACHE_STATEFILE); } #endif @@ -4457,7 +4405,6 @@ static void tagcache_thread(void) { struct queue_event ev; bool check_done = false; - char path[MAX_PATH]; /* If the previous cache build/update was interrupted, commit * the changes first in foreground. */ @@ -4474,8 +4421,7 @@ static void tagcache_thread(void) check_done = tagcache_dumpload(); } - remove(get_user_file_path(TAGCACHE_STATEFILE, IS_FILE | NEED_WRITE, - path, sizeof(path))); + remove(TAGCACHE_STATEFILE); # endif /* Allocate space for the tagcache if found on disk. */ @@ -4508,8 +4454,7 @@ static void tagcache_thread(void) case Q_REBUILD: remove_files(); - remove(get_user_file_path(TAGCACHE_FILE_TEMP, - IS_FILE|NEED_WRITE, path, sizeof(path))); + remove(TAGCACHE_FILE_TEMP); tagcache_build("/"); break; diff --git a/apps/tree.c b/apps/tree.c index 86238c50d9..98880f001a 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -261,8 +261,7 @@ static int tree_voice_cb(int selected_item, void * data) bool check_rockboxdir(void) { - char path[MAX_PATH]; - if(!dir_exists(get_user_file_path(ROCKBOX_DIR, 0, path, sizeof(path)))) + if(!dir_exists(ROCKBOX_DIR)) { /* No need to localise this message. If .rockbox is missing, it wouldn't work anyway */ int i; -- cgit