[libpeas/meson.msvc: 18/19] peas-demo: Don't hardcode installed paths on Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas/meson.msvc: 18/19] peas-demo: Don't hardcode installed paths on Windows
- Date: Fri, 9 Oct 2020 01:56:23 +0000 (UTC)
commit 1656eb4188bf0388795c1422248ae193a0f30311
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Oct 15 17:39:40 2018 +0800
peas-demo: Don't hardcode installed paths on Windows
Construct the paths dynamically, since things tend to be relocated on
Windows regularly.
peas-demo/peas-demo.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c
index 466a3923..c6c0cf3f 100644
--- a/peas-demo/peas-demo.c
+++ b/peas-demo/peas-demo.c
@@ -154,9 +154,36 @@ main (int argc,
if (run_from_build_dir)
peas_engine_add_search_path (engine, PEAS_BUILDDIR "/peas-demo/plugins", NULL);
else
- peas_engine_add_search_path (engine,
- PEAS_LIBDIR "/peas-demo/plugins/",
- PEAS_PREFIX "/share/peas-demo/plugins");
+ {
+ char *prefix;
+ char *demo_pluginlibdir, *demo_plugindatadir;
+
+ peas_engine_add_search_path (engine,
+ PEAS_LIBDIR "/peas-demo/plugins/",
+ PEAS_PREFIX "/share/peas-demo/plugins");
+
+#ifdef G_OS_WIN32
+ /* this is so that the paths are relocatable on Windows */
+ prefix = g_win32_get_package_installation_directory_of_module (NULL);
+ demo_pluginlibdir = g_build_filename (prefix,
+ "lib",
+ "peas-demo",
+ "plugins",
+ NULL);
+ demo_plugindatadir = g_build_filename (prefix,
+ "share",
+ "peas-demo",
+ "plugins",
+ NULL);
+ peas_engine_add_search_path (engine,
+ demo_pluginlibdir,
+ demo_plugindatadir);
+
+ g_free (demo_plugindatadir);
+ g_free (demo_pluginlibdir);
+ g_free (prefix);
+#endif
+ }
n_windows = 0;
main_window = create_main_window ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]