Trees | Indices | Help |
|
---|
|
1 #-*- coding: utf8 -* 2 # 3 # Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008 4 # 5 # This file is part of XYZCommander. 6 # XYZCommander is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU Lesser Public License as published by 8 # the Free Software Foundation, either version 3 of the License, or 9 # (at your option) any later version. 10 # XYZCommander is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Lesser Public License for more details. 14 # You should have received a copy of the GNU Lesser Public License 15 # along with XYZCommander. If not, see <http://www.gnu.org/licenses/>. 16 17 """ 18 Class is used to select first appropriate path. 19 """ 20 21 import os 22 import os.path 23 24 from libxyz import const 2527 """ 28 Class is used to select first appropriate path. 29 Common rule is to load system file first and then user's one 30 """ 318533 self.user_dir = os.path.join(os.path.expanduser("~"), const.USER_DIR) 34 self.system_dir = const.SYSTEM_DIR 35 self.conf_dir = const.CONF_DIR 36 self.skins_dir = const.SKINS_DIR 37 self.plugins_dir = const.PLUGINS_DIR38 39 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4042 """ 43 Return tuple of (system_conf_path, user_conf_path) 44 """ 45 46 return self._get(self.conf_dir, conf)47 48 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4951 """ 52 Return tuple of (system_skin_path, user_skin_path) 53 """ 54 55 return self._get(self.skins_dir, skin)56 57 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5860 _userpath = os.path.join(self.user_dir, subdir, obj) 61 _systempath = os.path.join(self.system_dir, subdir, obj) 62 63 return (_systempath, _userpath)64 65 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6668 """ 69 Return first existing file from supplied files or False in none exist 70 """ 71 72 for _file in files: 73 if os.access(_file, os.R_OK): 74 return _file 75 76 return None77 78 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 79
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Aug 3 02:02:16 2009 | http://epydoc.sourceforge.net |