diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2018-10-15 17:39:40 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2018-10-16 11:24:55 +0800 |
commit | ebdab55c36a865516be44c0b006921fc07ad2483 (patch) | |
tree | 704bad22e8ac1cb9901413e8cc84ac3bd2408ba0 | |
parent | d321ef97163b786207d59784babc6ddf60fa184b (diff) | |
download | libpeas-ebdab55c36a865516be44c0b006921fc07ad2483.tar.gz |
peas-demo: Don't hardcode installed paths on Windows
Construct the paths dynamically, since things tend to be relocated on
Windows regularly.
-rw-r--r-- | peas-demo/peas-demo.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c index 2a996f8..ecbd8ca 100644 --- a/peas-demo/peas-demo.c +++ b/peas-demo/peas-demo.c @@ -143,9 +143,29 @@ 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, *libdir; + char *demo_pluginlibdir, *demo_plugindatadir; + +#ifdef G_OS_WIN32 + prefix = g_win32_get_package_installation_directory_of_module (NULL); + libdir = g_build_filename (prefix, "lib", "libpeas-1.0", NULL); +#else + prefix = g_strdup (PEAS_PREFIX); + libdir = g_strdup (PEAS_LIBDIR); +#endif + demo_pluginlibdir = g_build_filename (libdir, "peas-demo", "plugins", NULL); + demo_plugindatadir = g_build_filename (prefix, "share", "libpeas-1.0", "peas-demo", "plugins", NULL); + + peas_engine_add_search_path (engine, + demo_pluginlibdir, + demo_plugindatadir); + + g_free (demo_plugindatadir); + g_free (demo_pluginlibdir); + g_free (libdir); + g_free (prefix); + } n_windows = 0; main_window = create_main_window (); |