summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-09-22 20:32:52 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-09-22 20:32:52 +0200
commitbc7eac560f827ac19dd9db16eac64a5da00b8dba (patch)
tree10977dbd430bab0a4298aff4cf6ff0b88979bb47
parentcc694ad47311c7413b28387c967524b6f54b622c (diff)
Force relative path for logs, for full path you can still use symlinks anyway
-rw-r--r--src/common/text.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 220fca1b..54eb3667 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -596,6 +596,20 @@ log_create_pathname (char *servname, char *channame, char *netname)
 	strftime (fnametime, sizeof (fnametime), fname, tm);
 
 	/* create final path/filename */
+#if 0
+	/* Don't check for absolute path, it's unreliable and you can use symlinks anyway.
+	 * For example, if you use "%c/...", %c will be empty upon connecting since there's
+	 * no channel name yet, so it will consider it as a full path, thus your logs will be
+	 * scattered all over the filesystem.
+	 * Also, drive letter's not checked correctly, Z should be the last letter, but this
+	 * code will consider anything with an ASCII value bigger than 'A' followed by a colon
+	 * as full path on Windows. On Unix, you simply can't determine reliably if a path is
+	 * full or relative, "/something" could be considered both as a relative or absolute
+	 * path.
+	 * Let's just force using the config folder as a starting point and allow relative
+	 * paths, although everyone should stay in their config folder. For absolute path you
+	 * can use ln -s (Unix) or mklink (Windows).
+	 */
 #ifdef WIN32
 	if (fnametime[0] == '/' || (fnametime[0] >= 'A' && fnametime[1] == ':'))
 #else
@@ -603,7 +617,8 @@ log_create_pathname (char *servname, char *channame, char *netname)
 #endif
 		snprintf (fname, sizeof (fname), "%s", fnametime);
 	else
-		snprintf (fname, sizeof (fname), "%s/logs/%s", get_xdir_utf8 (), fnametime);
+#endif
+	snprintf (fname, sizeof (fname), "%s/logs/%s", get_xdir_utf8 (), fnametime);
 
 	/* now we need it in FileSystem encoding */
 	fs = xchat_filename_from_utf8 (fname, -1, 0, 0, 0);