Force relative path for logs, for full path you can still use symlinks anyway

This commit is contained in:
Berke Viktor 2012-09-22 20:32:52 +02:00
parent cc694ad473
commit bc7eac560f
1 changed files with 16 additions and 1 deletions

View File

@ -596,6 +596,20 @@ log_create_pathname (char *servname, char *channame, char *netname)
strftime (fnametime, sizeof (fnametime), fname, tm); strftime (fnametime, sizeof (fnametime), fname, tm);
/* create final path/filename */ /* 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 #ifdef WIN32
if (fnametime[0] == '/' || (fnametime[0] >= 'A' && fnametime[1] == ':')) if (fnametime[0] == '/' || (fnametime[0] >= 'A' && fnametime[1] == ':'))
#else #else
@ -603,7 +617,8 @@ log_create_pathname (char *servname, char *channame, char *netname)
#endif #endif
snprintf (fname, sizeof (fname), "%s", fnametime); snprintf (fname, sizeof (fname), "%s", fnametime);
else 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 */ /* now we need it in FileSystem encoding */
fs = xchat_filename_from_utf8 (fname, -1, 0, 0, 0); fs = xchat_filename_from_utf8 (fname, -1, 0, 0, 0);