mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
use path_append for setting directories is several settings
sprintf, strcpy, memccpy can all just go thru path_append with the added benefit of some path sanitizing too Change-Id: I33510b56a364b8b3a0b06f2ff14b76491f6e3870
This commit is contained in:
parent
47784a777e
commit
1dc22c7241
7 changed files with 23 additions and 22 deletions
|
@ -78,10 +78,7 @@ static size_t get_directory(char* dirbuf, size_t dirbuf_sz)
|
|||
pl_dir = global_settings.playlist_catalog_dir;
|
||||
}
|
||||
|
||||
/* remove duplicate leading '/' */
|
||||
path_strip_leading_separators(pl_dir, &pl_dir);
|
||||
|
||||
return strlcpy(dirbuf, pl_dir, dirbuf_sz);
|
||||
return path_append(dirbuf, pl_dir, PA_SEP_SOFT, dirbuf_sz);
|
||||
}
|
||||
|
||||
/* Retrieve playlist directory from config file and verify it exists
|
||||
|
@ -127,8 +124,8 @@ void catalog_set_directory(const char* directory)
|
|||
}
|
||||
else
|
||||
{
|
||||
strmemccpy(global_settings.playlist_catalog_dir,
|
||||
directory, sizeof(global_settings.playlist_catalog_dir));
|
||||
path_append(global_settings.playlist_catalog_dir, directory,
|
||||
PA_SEP_SOFT, sizeof(global_settings.playlist_catalog_dir));
|
||||
}
|
||||
initialize_catalog();
|
||||
}
|
||||
|
@ -204,8 +201,8 @@ restart:
|
|||
{
|
||||
if (strcmp(most_recent_playlist, selected_playlist)) /* isn't most recent one */
|
||||
{
|
||||
strmemccpy(most_recent_playlist, selected_playlist,
|
||||
sizeof(most_recent_playlist));
|
||||
path_append(most_recent_playlist, selected_playlist,
|
||||
PA_SEP_SOFT, sizeof(most_recent_playlist));
|
||||
most_recent_selection = 0;
|
||||
reopen_last_playlist = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue