b4n commented on this pull request.


> +
+       /* The return value shall have exactly the same size as the input. If 
the input is a
+        * GStrv (last element is NULL), the output will follow suit. */
+       if (!num)
+               num = g_strv_length(file_names);
+       /* Always include a terminating NULL, enables easy freeing with 
g_strfreev() */
+       names = g_new0(gchar *, num + 1);
+
+       prefix = utils_strv_find_common_prefix(file_names, num);
+       /* First: determine the common prefix, that will be stripped.
+        * Don't strip single-letter prefixes, such as '/' */
+       prefix_len = 0;
+       if (NZV(prefix) && prefix[1])
+       {
+               /* Only strip directory components, include trailing '/' */
+               start = strrchr(prefix, G_DIR_SEPARATOR);

> e.g. a file can contain the \ character on linux

Yes, handling of `\` has to be special-cased for Windows

> not sure if the same is true for / on Windows

I don't think so, IIUC both `\` and `/` are separators.  One simple 
non-optimized way to match it can be `"/" G_DIR_SEPARATOR_S` (e.g. preprocessor 
concatenation of either `"//"` or `"/\"`) together with things like `strpbrk()`.

> Are you sure we don't have problems with this elsewhere inside Geany? I.e. is 
> this something we support or not?

I'm not entirely sure, but I think so.  However, we're probably normalizing the 
path at some point, which means we might not encounter the issue with paths we 
handle anyway.
So this might not be so important in the end.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1445#discussion_r234339768

Reply via email to