13
0

only create user configuration directory if no explicit version was given

This commit is contained in:
Paul Davis 2015-03-11 12:12:08 -05:00
parent c9d10158f6
commit d563b1173b

View File

@ -98,16 +98,21 @@ user_config_directory (int version)
p = Glib::build_filename (p, user_config_directory_name (version)); p = Glib::build_filename (p, user_config_directory_name (version));
if (!Glib::file_test (p, Glib::FILE_TEST_EXISTS)) { if (version < 0) {
if (g_mkdir_with_parents (p.c_str(), 0755)) { /* Only create the user config dir if the version was negative,
error << string_compose (_("Cannot create Configuration directory %1 - cannot run"), meaning "for the current version.
p) << endmsg; */
if (!Glib::file_test (p, Glib::FILE_TEST_EXISTS)) {
if (g_mkdir_with_parents (p.c_str(), 0755)) {
error << string_compose (_("Cannot create Configuration directory %1 - cannot run"),
p) << endmsg;
exit (1);
}
} else if (!Glib::file_test (p, Glib::FILE_TEST_IS_DIR)) {
error << string_compose (_("Configuration directory %1 already exists and is not a directory/folder - cannot run"),
p) << endmsg;
exit (1); exit (1);
} }
} else if (!Glib::file_test (p, Glib::FILE_TEST_IS_DIR)) {
error << string_compose (_("Configuration directory %1 already exists and is not a directory/folder - cannot run"),
p) << endmsg;
exit (1);
} }
return p; return p;