builder: Don't use ":" in uri-as-filename

This confuses some versions of git, thinking the file is a uri
tingping/wmclass
Alexander Larsson 2015-12-02 14:07:09 +01:00
parent 44028aa273
commit 9fd6ce1779
1 changed files with 6 additions and 10 deletions

View File

@ -30,23 +30,19 @@ builder_uri_to_filename (const char *uri)
{
GString *s;
const char *p;
gboolean saw_slash = FALSE;
gboolean saw_after_slash = FALSE;
s = g_string_new ("");
for (p = uri; *p != 0; p++)
{
if (*p == '/')
if (*p == '/' || *p == ':')
{
saw_slash = TRUE;
if (saw_after_slash) /* Skip first slashes */
g_string_append_c (s, '_');
continue;
while (p[1] == '/' || p[1] == ':')
p++;
g_string_append_c (s, '_');
}
else if (saw_slash)
saw_after_slash = TRUE;
g_string_append_c (s, *p);
else
g_string_append_c (s, *p);
}
return g_string_free (s, FALSE);