1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Perform directory exists check before setting TLS cert path

This commit is contained in:
James Booth 2015-09-23 20:42:47 +01:00
parent 0321adde3e
commit 1eab57bd13

View File

@ -165,8 +165,13 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args)
cons_bad_cmd_usage(command);
return TRUE;
}
prefs_set_string(PREF_CERT_PATH, args[2]);
cons_show("Certificate path set to: %s", args[2]);
if (g_file_test(args[2], G_FILE_TEST_IS_DIR)) {
prefs_set_string(PREF_CERT_PATH, args[2]);
cons_show("Certificate path set to: %s", args[2]);
} else {
cons_show("Directory %s does not exist.", args[2]);
}
return TRUE;
} else if (g_strcmp0(args[1], "clear") == 0) {
prefs_set_string(PREF_CERT_PATH, NULL);