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,12 +290,18 @@ hts_settings_remove(const char *pathfmt, ...)
|
||||||
{
|
{
|
||||||
char fullpath[256];
|
char fullpath[256];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
va_start(ap, pathfmt);
|
va_start(ap, pathfmt);
|
||||||
hts_settings_buildpath(fullpath, sizeof(fullpath),
|
hts_settings_buildpath(fullpath, sizeof(fullpath),
|
||||||
pathfmt, ap, settingspath);
|
pathfmt, ap, settingspath);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
unlink(fullpath);
|
if (stat(fullpath, &st) == 0) {
|
||||||
|
if (S_ISDIR(st.st_mode))
|
||||||
|
rmdir(fullpath);
|
||||||
|
else
|
||||||
|
unlink(fullpath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue