gboolean val = *(gboolean *)optentry->arg_data;
gboolean reverse = (optentry->flags & G_OPTION_FLAG_REVERSE);
if ((val && !reverse) || (!val && reverse)) /* logical XOR */
s = g_strdup_printf("--%s", optentry->long_name);
}
break;
case G_OPTION_ARG_INT:
if (*(gint *)optentry->arg_data)
s = g_strdup_printf("--%s=%d", optentry->long_name, *(gint *)optentry->arg_data);
break;
case G_OPTION_ARG_STRING:
case G_OPTION_ARG_FILENAME:
if (*(gchar **)optentry->arg_data)
s = g_strdup_printf("--%s=%s", optentry->long_name, *(gchar **)optentry->arg_data);
Actually, we have no STRING, so I'll discard it (the original SM option reproducer by Eugene supported even string and filename arrays, but I removed them at some point as unneeded).
As of the FILENAME, GLib says "returned in the GLib filename encoding", which is native for POSIX and UTF-8 under Windows. So a conversion is probably needed under Windows (that didn't matter for SM, which is *nix only). I'll test it to be sure.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/637/files#r38775687
github-comments@lists.geany.org