On Wed, Apr 10, 2013 at 2:23 PM, Paul Davis <p...@linuxaudiosystems.com>wrote:

>
>
> On Wed, Apr 10, 2013 at 2:19 PM, Marc-André Lureau <
> marcandre.lur...@gmail.com> wrote:
>
>>
>> On Wed, Apr 10, 2013 at 8:08 PM, Paul Davis 
>> <p...@linuxaudiosystems.com>wrote:
>>
>>> i assume you mean as the fallback?
>>
>>
>> You said, "should first try checking for an environment variable and then
>> a path relative to the executable.", what environment variable? PKGDATADIR?
>> Who set it?
>>
>
> application or toolkit specific. the search order should be:
>
>     getenv (MYAPP_DATA_DIR)
>     get_executable_path () + sub-dir
>     standard system dir(s)
>     compile-time value
>
>
>> Is it only for the developper? If you have a good case for that extra
>> environment variable, I would suggest to submit a patch to
>> g_get_system_data_dirs(), It does the later, giving you a list of where to
>> look for the data. So it could easily be tweaked to look for more locations.
>>
>
> no. g_get_system_data_dirs() does not work for relocatable applications,
> at least not on *nix-ish systems.
>

just to reinforce that point, code from g_get_system_data_dirs():

#ifdef G_OS_WIN32
      data_dir_vector = (gchar **) g_win32_get_system_data_dirs_for_module
(NULL);
#else
      gchar *data_dirs = (gchar *) g_getenv ("XDG_DATA_DIRS");

      if (!data_dirs || !data_dirs[0])
          data_dirs = "/usr/local/share/:/usr/share/";

      data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
#endif

G_OS_WIN32 is the only case where the location of the executable/module is
taken into account. Total fail for OS X and arguably a PITA for linux etc.
as well.
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to