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 """ 319933 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_DIR 38 self.locale_dir = const.LOCALE_DIR39 40 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4143 """ 44 Return tuple of (system_conf_path, user_conf_path) 45 """ 46 47 return self._get(self.conf_dir, conf)48 49 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5052 """ 53 Return tuple of (system_skin_path, user_skin_path) 54 """ 55 56 return self._get(self.skins_dir, skin)57 58 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5961 _userpath = os.path.join(self.user_dir, subdir, obj) 62 _systempath = os.path.join(self.system_dir, subdir, obj) 63 64 return (_systempath, _userpath)65 66 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6769 """ 70 Return first existing file from supplied files or False in none exist 71 """ 72 73 for _file in files: 74 if os.access(_file, os.R_OK): 75 return _file 76 77 return None78 79 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8082 _userpath = os.path.join(self.user_dir, self.plugins_dir) 83 _systempath = os.path.join(self.system_dir, self.plugins_dir) 84 85 return [_userpath, _systempath]86 87 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8890 _userpath = os.path.join(self.user_dir, self.skins_dir) 91 _systempath = os.path.join(self.system_dir, self.skins_dir) 92 93 return [_userpath, _systempath]94 95 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 96
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Sep 16 01:52:01 2010 | http://epydoc.sourceforge.net |