* When called with -R, only remove art_cache and files.db in case users use an imporant directory as their db dir.

* Touch up log directory handling.  If there is no log dir, but there is a db dir, store the log in the db dir.
This commit is contained in:
Justin Maggard 2011-03-12 02:17:27 +00:00
parent 92561e56b8
commit b62d77571b
3 changed files with 15 additions and 3 deletions

View File

@ -546,6 +546,15 @@ init(int argc, char * * argv)
}
}
}
if( log_path[0] == '\0' )
{
if( db_path[0] == '\0' )
strncpy(log_path, DEFAULT_LOG_PATH, PATH_MAX);
else
strncpy(log_path, db_path, PATH_MAX);
}
if( db_path[0] == '\0' )
strncpy(db_path, DEFAULT_DB_PATH, PATH_MAX);
/* command line arguments processing */
for(i=1; i<argc; i++)
@ -676,7 +685,7 @@ init(int argc, char * * argv)
runtime_vars.port = 0; // triggers help display
break;
case 'R':
snprintf(real_path, sizeof(real_path), "rm -rf %s/*", db_path);
snprintf(real_path, sizeof(real_path), "rm -rf %s/files.db %s/art_cache", db_path, db_path);
system(real_path);
break;
case 'V':

View File

@ -19,6 +19,9 @@ media_dir=/opt
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
#db_dir=/var/cache/minidlna
# set this if you would like to specify the directory where you want MiniDLNA to store its log file
#log_dir=/var/log
# this should be a list of file names to check for when searching for album art
# note: names should be delimited with a forward slash ("/")
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

View File

@ -84,8 +84,8 @@ struct lan_addr_s lan_addr[MAX_LAN_ADDR];
sqlite3 * db;
char dlna_no_conv[] = "DLNA.ORG_OP=01;DLNA.ORG_CI=0";
char friendly_name[FRIENDLYNAME_MAX_LEN];
char db_path[PATH_MAX] = DEFAULT_DB_PATH;
char log_path[PATH_MAX] = DEFAULT_LOG_PATH;
char db_path[PATH_MAX] = {'\0'};
char log_path[PATH_MAX] = {'\0'};
struct media_dir_s * media_dirs = NULL;
struct album_art_name_s * album_art_names = NULL;
struct client_cache_s clients[CLIENT_CACHE_SLOTS];