[evince] libdocument: get backends directory from environment



commit 395312868baf4ee03c5118ee5c58f25601c2af1d
Author: Cédric Krier <ced b2ck com>
Date:   Tue Mar 9 13:25:57 2021 +0100

    libdocument: get backends directory from environment
    
    When bundling evince library, the directory of the backends is copied in
    another directory than the installation directory.
    
    For example, cx_freeze is a popular Python package for creating
    standalone executables from Python scripts. For applications using
    Evince as a library, cx_freeze copies the evince dlls in the main
    directory with the executable and the backends are copied to this
    directory. So the directory is relative to the directory where the
    executable is installed and not from the package installation
    directory of evince (because it is not really installed).
    
    Therefore, to help the use case where Evince is bundled as a library,
    and not installes, we need a way to specify dynamically the path of this
    new directory.
    
    See MR !327 for more discussion.

 libdocument/ev-document-factory.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c
index 19085eced..55e77e33b 100644
--- a/libdocument/ev-document-factory.c
+++ b/libdocument/ev-document-factory.c
@@ -233,6 +233,10 @@ _ev_document_factory_init (void)
        if (ev_backends_list)
                return TRUE;
 
+        if (g_getenv ("EV_BACKENDS_DIR") != NULL)
+                ev_backends_dir = g_strdup (g_getenv ("EV_BACKENDS_DIR"));
+
+       if (!ev_backends_dir) {
 #ifdef G_OS_WIN32
 {
         gchar *dir;
@@ -246,6 +250,7 @@ _ev_document_factory_init (void)
 #else
         ev_backends_dir = g_strdup (EV_BACKENDSDIR);
 #endif
+       }
 
         ev_backends_list = _ev_backend_info_load_from_dir (ev_backends_dir);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]