;ň ŃXAc@sdZdklZdkZeiiddƒZeiideiieddƒƒZ e geiidd ƒi d ƒZ eiid eiied ƒƒZ e geiid dƒi d ƒZ ed„e ƒZ ed„e ƒZ d„Zd„Zd„Zd„Zd„ZdS(sIThe freedesktop.org Base Directory specification provides a way for applications to locate shared data and configuration: http://www.freedesktop.org/standards/ This module can be used to load and save from and to these directories. Typical usage: from rox import basedir for dir in basedir.load_config_paths('mydomain.org', 'MyProg', 'Options'): print "Load settings from", dir dir = basedir.save_config_path('mydomain.org', 'MyProg') print >>file(os.path.join(dir, 'Options'), 'w'), "foo=2" Note: see the rox.Options module for a higher-level API for managing options. (s generatorsNsHOMEs/s XDG_DATA_HOMEs.localsshares XDG_DATA_DIRSs/usr/local/share:/usr/shares:sXDG_CONFIG_HOMEs.configsXDG_CONFIG_DIRSs/etc/xdgcCs|S(N(sx(sx((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pys%scGsotii|Œ}|idƒ pt‚tiit|ƒ}tii|ƒ oti|dƒn|SdS(sÚEnsure $XDG_CONFIG_HOME// exists, and return its path. 'resource' should normally be the name of your application. Use this when SAVING configuration settings. Use the xdg_config_dirs variable for loading.s/iŔN( sosspathsjoinsresources startswithsAssertionErrorsxdg_config_homesisdirsmakedirs(sresourcespath((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pyssave_config_path(scGsltii|Œ}|idƒ pt‚tiit|ƒ}tii|ƒ oti|ƒn|SdS(sÚEnsure $XDG_DATA_HOME// exists, and return its path. 'resource' is the name of some shared resource. Use this when updating a shared (between programs) database. Use the xdg_data_dirs variable for loading.s/N( sosspathsjoinsresources startswithsAssertionErrors xdg_data_homesisdirsmakedirs(sresourcespath((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pyssave_data_path4scgsWtii|Œ}x>tD]6}tii||ƒ}tii|ƒo|VqqWdS(sßReturns an iterator which gives each directory named 'resource' in the configuration search path. Information provided by earlier directories should take precedence over later ones (ie, the user's config dir comes first).N(sosspathsjoinsresourcesxdg_config_dirss config_dirsexists(sresources config_dirspath((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pysload_config_paths@scGs#xt|ŒD] }|Sq WtSdS(sVReturns the first result from load_config_paths, or None if there is nothing to load.N(sload_config_pathssresourcesxsNone(sresourcesx((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pysload_first_configIs  cgsWtii|Œ}x>tD]6}tii||ƒ}tii|ƒo|VqqWdS(sľReturns an iterator which gives each directory named 'resource' in the shared data search path. Information provided by earlier directories should take precedence over later ones.N(sosspathsjoinsresources xdg_data_dirssdata_dirsexists(sresourcesdata_dirspath((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pysload_data_pathsPs(s__doc__s __future__s generatorssossenvironsgets_homespathsjoins xdg_data_homessplits xdg_data_dirssxdg_config_homesxdg_config_dirssfilterssave_config_pathssave_data_pathsload_config_pathssload_first_configsload_data_paths( sxdg_config_homesxdg_config_dirssload_first_configs xdg_data_dirss xdg_data_homessave_config_pathsload_data_pathssload_config_pathss generatorss_homesosssave_data_path((sU/mnt/gmirror/ports/devel/py-roxlib/work/rox-lib2-2.0.5/ROX-Lib2/python/rox/basedir.pys?s    % %