wxstandardpathswxstandardpaths 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::getstatic wxstandardpathsbase& get() returns reference to the unique global standard paths object.
wxstandardpaths::getconfigdirwxstring getconfigdir() const return the directory containing the system config files. example return values:
see also
wxstandardpaths::getdatadirwxstring getdatadir() const return the location of the applications global, i.e. not user-specific, data files. example return values:
see also
wxstandardpaths::getdocumentsdirwxstring 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::getexecutablepathwxstring getexecutablepath() const return the directory and the filename for the current executable. example return values:
wxstandardpaths::getinstallprefixwxstring 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::getlocaldatadirwxstring 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::getlocalizedresourcesdirwxstring 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::getpluginsdirwxstring getpluginsdir() const return the directory where the loadable modules (plugins) live. example return values:
see also
wxstandardpaths::getresourcesdirwxstring 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
wxstandardpaths::gettempdirwxstring 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::getuserconfigdirwxstring 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::getuserdatadirwxstring getuserdatadir() const return the directory for the user-dependent application data files:
wxstandardpaths::getuserlocaldatadirwxstring 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::setinstallprefixvoid 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.
|