Add hidden "watch-dir-force-generic" setting handling to daemon

This commit is contained in:
Mike Gelfand 2016-01-25 22:09:49 +00:00
parent 39749f8e4b
commit 9e7293b710
2 changed files with 9 additions and 3 deletions

View File

@ -69,6 +69,7 @@ static const char *logfileName = NULL;
static tr_sys_file_t logfile = TR_BAD_SYS_FILE;
static tr_session * mySession = NULL;
static tr_quark key_pidfile = 0;
static tr_quark key_watch_dir_force_generic = 0;
static struct event_base *ev_base = NULL;
/***
@ -562,11 +563,15 @@ daemon_start (void * raw_arg,
if (tr_variantDictFindBool (settings, TR_KEY_watch_dir_enabled, &boolVal) && boolVal)
{
const char * dir;
bool force_generic;
if (!tr_variantDictFindBool (settings, key_watch_dir_force_generic, &force_generic))
force_generic = false;
if (tr_variantDictFindStr (settings, TR_KEY_watch_dir, &dir, NULL) && dir != NULL && *dir != '\0')
{
tr_logAddInfo ("Watching \"%s\" for new .torrent files", dir);
if ((watchdir = tr_watchdir_new (dir, &onFileAdded, mySession, ev_base, false)) == NULL)
if ((watchdir = tr_watchdir_new (dir, &onFileAdded, mySession, ev_base, force_generic)) == NULL)
goto cleanup;
}
}
@ -667,7 +672,8 @@ tr_main (int argc,
tr_variant * const settings = &arg.settings;
const char ** const configDir = &arg.configDir;
key_pidfile = tr_quark_new ("pidfile", 7);
key_pidfile = tr_quark_new ("pidfile", 7);
key_watch_dir_force_generic = tr_quark_new ("watch-dir-force-generic", 23);
/* load settings from defaults + config file */
tr_variantInitDict (settings, 0);

View File

@ -97,7 +97,7 @@ create_dir (const char * parent_dir,
tr_free (path);
}
tr_watchdir_t
static tr_watchdir_t
create_watchdir (const char * path,
tr_watchdir_cb callback,
void * callback_user_data,