settings: use PATH_MAX instead hardcoded value 256
settings: remove - if the directory is empty, remove it, too