pathfuncs.c add path_strip_leading_separators()

added to path_append as well

Change-Id: Ieb6ec4f4c475ca5e60c8246c7f044bcc7651f6bf
This commit is contained in:
William Wilgus 2024-03-29 16:09:56 -04:00 committed by William Wilgus
parent 777098fca9
commit fe00906abb
3 changed files with 24 additions and 8 deletions

View file

@ -70,7 +70,7 @@ static int browser_status = CATBROWSE_NOTHING;
static size_t get_directory(char* dirbuf, size_t dirbuf_sz)
{
char *pl_dir = PLAYLIST_CATALOG_DEFAULT_DIR;
const char *pl_dir = PLAYLIST_CATALOG_DEFAULT_DIR;
/* directory config is of the format: "dir: /path/to/dir" */
if (global_settings.playlist_catalog_dir[0] != '\0')
@ -79,10 +79,7 @@ static size_t get_directory(char* dirbuf, size_t dirbuf_sz)
}
/* remove duplicate leading '/' */
if (pl_dir[0] == '/' && pl_dir[1] == '/')
{
pl_dir++;
}
path_strip_leading_separators(pl_dir, &pl_dir);
return strlcpy(dirbuf, pl_dir, dirbuf_sz);
}