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

J-P Nurmi jpnurmi at qt.io
Wed Nov 16 13:06:43 CET 2016


> On 11 Nov 2016, at 17:10, Matthew Woehlke <mwoehlke.floss at gmail.com> wrote:
> 
> 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` :-).

+1 for _DIR for single directories, and _PATH for list of directories.

--
J-P Nurmi




More information about the Development mailing list