gi-decompile-typelib: Interpret --includedir as most-important-first

This is a behaviour change from g-ir-generate, which treats it as
least-important-first (the last directory on the command-line is
searched first).

gi-compile-repository --includedir and gcc -I are most-important-first
(the first directory on the command-line is searched first) so it seems
like it makes most sense to be consistent with that.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-02-14 11:25:46 +00:00
parent f80e978f00
commit 64762fdef6
2 changed files with 14 additions and 3 deletions

View File

@ -91,6 +91,12 @@ your code if integer type warnings are enabled.
| `g-ir-generate` | `gi-decompile-typelib` |
| `g-ir-inspect` | `gi-inspect-typelib` |
In addition, the `--version` option for `g-ir-inspect` has been renamed to
In addition, some command-line options have been changed.
The `--version` option for `g-ir-inspect` has been renamed to
`--typelib-version` in `gi-inspect-typelib`.
The `--includedir` option to `gi-decompile-typelib` treats the
given directories as most-important-first, consistent with
`gi-compile-repository --includedir` and `gcc -I`.
`g-ir-generate` treated `--includedir` options as least-important-first.

View File

@ -87,8 +87,13 @@ main (int argc, char *argv[])
repository = gi_repository_new ();
if (includedirs != NULL)
for (i = 0; includedirs[i]; i++)
gi_repository_prepend_search_path (repository, includedirs[i]);
{
guint n = g_strv_length (includedirs);
guint j;
for (j = 1; j <= n; j++)
gi_repository_prepend_search_path (repository, includedirs[n - j]);
}
for (i = 0; input[i]; i++)
{