When writing plugins or scripts it is often necessary to get information about the paths QGIS is using. For example, if we are writing a plugin that uses Python templates to create output based on user actions, we need to know the path to our installed plugin so we can find the templates. Fortunately the API provides an easy way to get at the information; here are a few examples:
- QgsApplication.pluginPath(): location of core plugins
- QgsApplication.prefixPath(): location where QGIS is installed
- QgsApplication.qgisSettingsDirPath(): location of user settings
- QgsApplication.iconsPath(): location of icons used in QGIS
We can get a summary of some paths used in QGIS using showSettings
These paths are from my development install of QGIS on a Linux box; yours will be different.
The showSettings method is not really useful in a script or plugin since it returns a string containing line returns and tab characters. It's mainly useful for debugging and development.
From within a plugin, you can get its path using