Function
GLibWin32get_package_installation_directory
deprecated: 2.18
Declaration [src]
gchar*
g_win32_get_package_installation_directory (
const gchar* package,
const gchar* dll_name
)
Description [src]
Try to determine the installation directory for a software package.
This function is deprecated. Use
g_win32_get_package_installation_directory_of_module() instead.
The use of package is deprecated. You should always pass NULL. A
warning is printed if non-NULL is passed as package.
The original intended use of package was for a short identifier of
the package, typically the same identifier as used for
GETTEXT_PACKAGE in software configured using GNU
autotools. The function first looks in the Windows Registry for the value InstallationDirectory in the key
HKLM`\Software\`package, and if that value
exists and is a string, returns that.
It is strongly recommended that packagers of GLib-using libraries for Windows do not store installation paths in the Registry to be used by this function as that interferes with having several parallel installations of the library. Enabling multiple installations of different versions of some GLib-using library, or GLib itself, is desirable for various reasons.
For this reason it is recommended to always pass NULL as
package to this function, to avoid the temptation to use the
Registry. In version 2.20 of GLib the package parameter
will be ignored and this function won’t look in the Registry at all.
If package is NULL, or the above value isn’t found in the
Registry, but dll_name is non-NULL, it should name a DLL loaded
into the current process. Typically that would be the name of the
DLL calling this function, looking for its installation
directory. The function then asks Windows what directory that DLL
was loaded from. If that directory’s last component is “bin” or
“lib”, the parent directory is returned, otherwise the directory
itself. If that DLL isn’t loaded, the function proceeds as if
dll_name was NULL.
If both package and dll_name are NULL, the directory from where
the main executable of the process was loaded is used instead in
the same way as above.
Deprecated since: 2.18
Pass the HMODULE of a DLL or EXE to
g_win32_get_package_installation_directory_of_module() instead.
Parameters
package-
Type:
const gchar*You should pass
NULLfor this.The argument can be NULL.The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. dll_name-
Type:
const gchar*The name of a DLL that a package provides in UTF-8, or
NULL.The argument can be NULL.The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string.
Return value
Type: gchar*
A string containing the installation directory for
package. The string is in the GLib file name encoding,
i.e. UTF-8. The return value should be freed with g_free() when not
needed any longer. If the function fails NULL is returned.
| The caller of the function takes ownership of the data, and is responsible for freeing it. |
| The value is a NUL terminated UTF-8 string. |