create .config dir if it does not exist (issue #629)
o9000 mrovi9000@gmail.com
1 files changed,
5 insertions(+),
0 deletions(-)
jump to
M
src/config.c
→
src/config.c
@@ -1274,6 +1274,11 @@ }
// generate config file fprintf(stderr, "tint2 warning: could not find a config file!\n"); + // According to the XDG Base Directory Specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html) + // if the user's config directory does not exist, we should create it with permissions set to 0700. + if (!g_file_test(g_get_user_config_dir(), G_FILE_TEST_IS_DIR)) + g_mkdir(g_get_user_config_dir(), 0700); + gchar *dir = g_build_filename(g_get_user_config_dir(), "tint2", NULL); if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) g_mkdir(dir, 0700);