Modify hts_settings_remove to also remove (empty) dirs.
This commit is contained in:
parent
bfa18f5440
commit
1ad73ec803
1 changed files with 7 additions and 1 deletions
|
@ -290,13 +290,19 @@ hts_settings_remove(const char *pathfmt, ...)
|
|||
{
|
||||
char fullpath[256];
|
||||
va_list ap;
|
||||
struct stat st;
|
||||
|
||||
va_start(ap, pathfmt);
|
||||
hts_settings_buildpath(fullpath, sizeof(fullpath),
|
||||
pathfmt, ap, settingspath);
|
||||
va_end(ap);
|
||||
if (stat(fullpath, &st) == 0) {
|
||||
if (S_ISDIR(st.st_mode))
|
||||
rmdir(fullpath);
|
||||
else
|
||||
unlink(fullpath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue