Add test for g_path_skip_root().

2001-01-05  Tor Lillqvist  <tml@iki.fi>

	* testglib.c (main): Add test for g_path_skip_root().

	* gutils.c (g_path_skip_root): Fix bugs in code I just added ;-)
This commit is contained in:
Tor Lillqvist
2001-01-05 20:19:37 +00:00
committed by Tor Lillqvist
parent ebf8fe6a92
commit 71e0f93747
12 changed files with 156 additions and 22 deletions

View File

@@ -472,12 +472,28 @@ g_path_skip_root (gchar *file_name)
g_return_val_if_fail (file_name != NULL, NULL);
#ifdef G_OS_WIN32
/* Skip \\server\share\ */
/* Skip \\server\share */
if (file_name[0] == G_DIR_SEPARATOR &&
file_name[1] == G_DIR_SEPARATOR &&
file_name[2] &&
strchr (file_name + 2, G_DIR_SEPARATOR) > file_name + 2)
return strchr (file_name + 2, G_DIR_SEPARATOR) + 1;
file_name[2])
{
gchar *p, *q;
if ((p = strchr (file_name + 2, G_DIR_SEPARATOR)) > file_name + 2 &&
p[1])
{
file_name = p + 1;
while (file_name[0] && file_name[0] != G_DIR_SEPARATOR)
file_name++;
/* Possibly skip a backslash after the share name */
if (file_name[0] == G_DIR_SEPARATOR)
file_name++;
return file_name;
}
}
#endif
/* Skip initial slashes */