Miscellaneous Utility Functions

G-Golf Glib Miscellaneous Utility Functions low level API.
Miscellaneous Utility Functions - a selection of portable utility functions

Procedures

g-get-prgname
g-set-prgname
g-get-system-data-dirs
g-get-system-config-dirs
g-get-os-info

Description

These are portable utility functions.

Procedures

Procedure: g-get-prgname

Returns the name of the program, or #f if it has not been set yet.

Obtains and returns the name of the program. This name should not be localized, in contrast to g-get-application-name.

If you are using GApplication, the program name is set in g-application-run.

Procedure: g-set-prgname name

Returns nothing.

Sets the name of the program to name. This name should not be localized, in contrast to g-set-application-name.

If you are using GApplication, the program name is set in g-application-run.

Note that for thread-safety reasons this function can only be called once.

Procedure: g-get-system-data-dirs

Returns an ordered list of base directories in which to access system-wide application data.

On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the list of directories retrieved will be XDG_DATA_DIRS.

On Windows it follows XDG Base Directory Specification if XDG_DATA_DIRS is defined. If XDG_DATA_DIRS is undefined, the first elements in the list are the Application Data and Documents folders for All Users. (These can be determined only on Windows 2000 or later and are not present in the list on other Windows versions.) See documentation for CSIDL_COMMON_APPDATA and CSIDL_COMMON_DOCUMENTS.

Then follows the "share" subfolder in the installation folder for the package containing the DLL that calls this function, if it can be determined.

Finally the list contains the "share" subfolder in the installation folder for GLib, and in the installation folder for the package the application’s .exe file belongs to.

The installation folders above are determined by looking up the folder where the module (DLL or EXE) in question is located. If the folder’s name is "bin", its parent is used, otherwise the folder itself.

Note that on Windows the returned list can vary depending on where this function is called.

Procedure: g-get-system-config-dirs

Returns an ordered list of base directories in which to access system-wide configuration information.

On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the list of directories retrieved will be XDG_CONFIG_DIRS.

On Windows it follows XDG Base Directory Specification if XDG_CONFIG_DIRS is defined. If XDG_CONFIG_DIRS is undefined, the directory that contains application data for all users is used instead. A typical path is C:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This information will not roam and is available to anyone using the computer.

Procedure: g-get-os-info key-name

Returns a string or #f.

Obtains and returns information about the operating system.

On Linux this comes from the /etc/os-release file. On other systems, it may come from a variety of sources. You can pass any UTF-8 string key name.

The associated value for the requested key-name is returned or #f if this information is not provided.