static gchar *dvd_device = NULL;
static gchar *arg_preset = NULL;
static gboolean ghb_debug = FALSE;
+static gchar *arg_config_dir = NULL;
#if defined(_WIN32)
static gboolean win32_console = FALSE;
#endif
{ "device", 'd', 0, G_OPTION_ARG_FILENAME, &dvd_device, N_("The device or file to encode"), NULL },
{ "preset", 'p', 0, G_OPTION_ARG_STRING, &arg_preset, N_("The preset values to use for encoding"), NULL },
{ "debug", 'x', 0, G_OPTION_ARG_NONE, &ghb_debug, N_("Spam a lot"), NULL },
+ { "config", 'o', 0, G_OPTION_ARG_STRING, &arg_config_dir, N_("The path to override user config dir"), NULL },
#if defined(_WIN32)
{ "console",'c', 0, G_OPTION_ARG_NONE, &win32_console, N_("Open a console for debug output"), NULL },
#endif
#endif
ghb_udev_init();
+ // Override user config dir
+ if (arg_config_dir != NULL)
+ {
+ ghb_override_user_config_dir(arg_config_dir);
+ }
+
ghb_write_pid_file();
ud = g_malloc0(sizeof(signal_user_data_t));
ud->debug = ghb_debug;
static GhbValue *prefsDict = NULL;
static gboolean prefs_modified = FALSE;
+static gchar *override_user_config_dir = NULL;
static void store_prefs(void);
static void store_presets(void);
const gchar *dir;
gchar *config;
- dir = g_get_user_config_dir();
+ if (override_user_config_dir != NULL)
+ {
+ dir = override_user_config_dir;
+ }
+ else
+ {
+ dir = g_get_user_config_dir();
+ }
if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
{
dir = g_get_home_dir();
return config;
}
+void
+ghb_override_user_config_dir(char *dir)
+{
+ override_user_config_dir = dir;
+}
+
static void
write_config_file(const gchar *name, GhbValue *dict)
{
GhbValue* ghb_load_old_queue(int pid);
void ghb_remove_old_queue_file(int pid);
gchar* ghb_get_user_config_dir(gchar *subdir);
+void ghb_override_user_config_dir(char *dir);
void ghb_settings_to_ui(signal_user_data_t *ud, GhbValue *dict);
void ghb_clear_presets_selection(signal_user_data_t *ud);
void ghb_select_preset(GtkBuilder *builder, const char *name);