summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-07-26 22:18:38 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-07-26 22:18:38 +0200
commit52175f439a9fad9bc44dbbf9c3b1716b3dfe8e72 (patch)
tree5a394c0fa8d156ed3c6e5a21ae72cfb7eb078786 /src
parentec301a5a5486898cb4d9854a56eb866f1b93f634 (diff)
Don't hardcode path when printing error message for config dir creation
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index e9dc8780..da2fc107 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -359,26 +359,21 @@ static void
 check_prefs_dir (void)
 {
 	char *dir = get_xdir_fs ();
+	static char *msg = NULL;
+
 	if (access (dir, F_OK) != 0)
 	{
 #ifdef WIN32
 		if (mkdir (dir) != 0)
-		{
-			if (portable_mode ())
-			{
-				fe_message (_("Cannot create .\\config"), FE_MSG_ERROR);
-			}
-			else
-			{
-				fe_message (_("Cannot create %APPDATA%\\HexChat"), FE_MSG_ERROR);
-			}
-		}
 #else
 		if (mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR) != 0)
+#endif
 		{
-			fe_message (_("Cannot create ~/.config/hexchat"), FE_MSG_ERROR);
+			msg = malloc (strlen (get_xdir_fs ()) + 15);
+			sprintf (msg, "Cannot create %s", get_xdir_fs ());
+			fe_message (msg, FE_MSG_ERROR);
+			free (msg);
 		}
-#endif
 	}
 }