Add debian directory
[lxde/lxinput.git] / debian / apport / source_lxinput.py
1 """
2 Copyright (c) 2010 Julien Lavergne <gilir@ubuntu.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 """
18
19 import os
20 import apport.hookutils
21
22 #Detect session
23 session = os.environ['DESKTOP_SESSION']
24
25 #If it's not a specific session, fallback to LXDE
26 if not session:
27 session = "LXDE"
28
29 #Set location of various configuration files
30 system_conf = "/etc/xdg/lxsession/"
31 home_conf = os.path.expanduser("~/.config/lxsession/")
32
33 #Set description for each file reported by apport
34 report_config_system = "Config_System_" + session
35 report_config_home = "Config_Home_" + session
36
37 def add_info(report):
38 # If a config file exist in HOME, report it instead of the system one.
39 if os.path.exists(os.path.join(home_conf,session,"desktop.conf")):
40 report[report_config_home] = apport.hookutils.read_file(os.path.join(home_conf,session,"desktop.conf"))
41 else:
42 report[report_config_system] = apport.hookutils.read_file(os.path.join(system_conf,session,"desktop.conf"))