Re: g_get_home_dir, g_get_tmp_dir



> g_get_home_dir() is actually meant (at least on unixen) to return the
> directory that you'd want to find/put an applications config files, and
> to return the string that is needed to expand ~/... paths.
> since you mention you already handled this in your gimp patches specifically,
> what heuristics do you actually use to find a home dir if g_get_home_dir()
> returns NULL?

I don't. I accept the fact that there is no home directory, and look
for / store personal config files in the gimp installation directory
suffixed with the user name (which can be "somebody" if the user name
isn't known). For instance, C:\gimp\gimprc.somebody. Hmm, probably one
should be able to ovberride this in the system gimprc in case the
installation directory is read-only.

On Windows, I get the installation directory by asking the system for
the executable name using GetModuleFileName. On Unix, one would have
to search the PATH for argv[0]. Then you don't have to know the
installation directory when compiling (DATADIR).

> are you hiding something there, that should eventually go into
> g_get_home_dir() itself? ;)))

Well, not in not g_get_home_dir (), but sure, parts of gimprc.c
could/should be made more generic and moved into glib. Functions to
find out the installation directory (from argv[0] and PAT, or from the
system), to handle building the names of various personal
configuration files, to rename a pesonal config file to .old and open
a new, etc.

--tml



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