Modify hts_settings_remove to also remove (empty) dirs.

This commit is contained in:
Adam Sutton 2012-10-09 15:07:13 +01:00
parent bfa18f5440
commit 1ad73ec803

View file

@ -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);
}
}
/**
*