Contents Up Previous Next

wxStandardPaths

wxStandardPaths returns the standard locations in the file system and should be used by applications to find their data files in a portable way.

In the description of the methods below, the example return values are given for the Unix, Windows and Mac OS X systems, however please note that these are just the examples and the actual values may differ. For example, under Windows: the system administrator may change the standard directories locations, i.e. the Windows directory may be named W:\Win2003 instead of the default C:\Windows.

The strings appname and username should be replaced with the value returned by wxApp::GetAppName and the name of the currently logged in user, respectively. The string prefix is only used under Unix and is /usr/local by default but may be changed using SetInstallPrefix.

The directories returned by the methods of this class may or may not exist. If they don't exist, it's up to the caller to create them, wxStandardPaths doesn't do it.

Finally note that these functions only work with standardly packaged applications. I.e. under Unix you should follow the standard installation conventions and under Mac you should create your application bundle according to the Apple guidelines. Again, this class doesn't help you to do it.

This class is MT-safe: its methods may be called concurrently from different threads without additional locking.

Derived from

No base class

Include files

<wx/stdpaths.h>

Members

wxStandardPaths::Get
wxStandardPaths::GetConfigDir
wxStandardPaths::GetDataDir
wxStandardPaths::GetDocumentsDir
wxStandardPaths::GetExecutablePath
wxStandardPaths::GetInstallPrefix
wxStandardPaths::GetLocalDataDir
wxStandardPaths::GetLocalizedResourcesDir
wxStandardPaths::GetPluginsDir
wxStandardPaths::GetResourcesDir
wxStandardPaths::GetTempDir
wxStandardPaths::GetUserConfigDir
wxStandardPaths::GetUserDataDir
wxStandardPaths::GetUserLocalDataDir
wxStandardPaths::SetInstallPrefix


wxStandardPaths::Get

static wxStandardPathsBase& Get()

Returns reference to the unique global standard paths object.


wxStandardPaths::GetConfigDir

wxString GetConfigDir() const

Return the directory containing the system config files.

Example return values:

See also

wxFileConfig


wxStandardPaths::GetDataDir

wxString GetDataDir() const

Return the location of the applications global, i.e. not user-specific, data files.

Example return values:

See also

GetLocalDataDir


wxStandardPaths::GetDocumentsDir

wxString GetDocumentsDir() const

Return the directory containing the current user's documents.

Example return values:

This function is new since wxWidgets version 2.7.0


wxStandardPaths::GetExecutablePath

wxString GetExecutablePath() const

Return the directory and the filename for the current executable.

Example return values:


wxStandardPaths::GetInstallPrefix

wxString GetInstallPrefix() const

Note: This function is only available under Unix.

Return the program installation prefix, e.g. /usr, /opt or /home/zeitlin.

If the prefix had been previously by SetInstallPrefix, returns that value, otherwise tries to determine it automatically (Linux only right now) and finally returns the default /usr/local value if it failed.


wxStandardPaths::GetLocalDataDir

wxString GetLocalDataDir() const

Return the location for application data files which are host-specific and can't, or shouldn't, be shared with the other machines.

This is the same as GetDataDir() except under Unix where it returns /etc/appname.


wxStandardPaths::GetLocalizedResourcesDir

wxString GetLocalizedResourcesDir(const wxChar* lang, ResourceCat category = ResourceCat_None) const

Return the localized resources directory containing the resource files of the specified category for the given language.

In general this is just the same as lang subdirectory of GetResourcesDir() (or lang.lproj under Mac OS X) but is something quite different for message catalog category under Unix where it returns the standard prefix/share/locale/lang/LC_MESSAGES directory.

This function is new since wxWidgets version 2.7.0


wxStandardPaths::GetPluginsDir

wxString GetPluginsDir() const

Return the directory where the loadable modules (plugins) live.

Example return values:

See also

wxDynamicLibrary


wxStandardPaths::GetResourcesDir

wxString GetResourcesDir() const

Return the directory where the application resource files are located. The resources are the auxiliary data files needed for the application to run and include, for example, image and sound files it might use.

This function is the same as GetDataDir for all platforms except Mac OS X.

Example return values:

This function is new since wxWidgets version 2.7.0

See also

GetLocalizedResourcesDir


wxStandardPaths::GetTempDir

wxString GetTempDir() const

Return the directory for storing temporary files. To create unique temporary files, it is best to use wxFileName::CreateTempFileName for correct behaviour when multiple processes are attempting to create temporary files.

This function is new since wxWidgets version 2.7.2


wxStandardPaths::GetUserConfigDir

wxString GetUserConfigDir() const

Return the directory for the user config files:

Only use this method if you have a single configuration file to put in this directory, otherwise GetUserDataDir() is more appropriate.


wxStandardPaths::GetUserDataDir

wxString GetUserDataDir() const

Return the directory for the user-dependent application data files:


wxStandardPaths::GetUserLocalDataDir

wxString GetUserLocalDataDir() const

Return the directory for user data files which shouldn't be shared with the other machines.

This is the same as GetUserDataDir() for all platforms except Windows where it returns C:\Documents and Settings\username\Local Settings\Application Data\appname


wxStandardPaths::SetInstallPrefix

void SetInstallPrefix(const wxString& prefix)

Note: This function is only available under Unix.

Lets wxStandardPaths know about the real program installation prefix on a Unix system. By default, the value returned by GetInstallPrefix is used.

Although under Linux systems the program prefix may usually be determined automatically, portable programs should call this function. Usually the prefix is set during program configuration if using GNU autotools and so it is enough to pass its value defined in config.h to this function.