[Development] Naming of path/directory-related environment variables in Qt

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Nov 11 17:10:11 CET 2016


On 2016-11-11 10:13, Mitch Curtis wrote:
> I'd like to establish some kind of convention for naming
> path/directory-related environment variables in Qt, with the hope
> that it could be set in stone with e.g. one of these newfangled
> QUIPs. [...] So, can we all agree on using "PATH" when naming
> environment variables that refer to paths?

I believe that `FOO_DIR` is typical for variables that name a *single*
directory. For multiple directories, XDG prefers `FOO_DIRS`, but
otherwise `FOO_PATH` seems most common.

Examples:
 PATH (duh)
 LD_LIBRARY_PATH
 PYTHONPATH
 LUA_PATH
 QT_PLUGIN_PATH
 LIBPATH
 COMPILER_PATH
 LIBRARY_PATH
 CPATH
 C_INCLUDE_PATH
 CPLUS_INCLUDE_PATH

 TMPDIR
 KDEDIRS
 XDG_DATA_DIRS
 XDG_RUNTIME_DIR

I think a good rule would be single directories should use _DIR if
anything (some cases e.g. HOME may be exceptions), and list of
directories should use _PATH.

Please don't use `FOO_FOLDER` :-).

-- 
Matthew




More information about the Development mailing list