ScolaSync  1.0
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
globaldef.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # $Id: globaldef.py 47 2011-06-13 10:20:14Z georgesk $
4 
5 ##
6 #
7 # globaldef.py is part of the package scolasync. This module contains
8 # some definitions which can be reused globally in the application
9 #
10 
11 licenceEn="""
12  scolasync version %s:
13 
14  a program to manage file transfers between a computer and a collection
15  of USB sticks.
16 
17  Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
18 
19  This program is free software: you can redistribute it and/or modify
20  it under the terms of the GNU General Public License as published by
21  the Free Software Foundation, either version 3 of the License, or
22  (at your option) any later version.
23 
24  This program is distributed in the hope that it will be useful,
25  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  GNU General Public License for more details.
28 
29  You should have received a copy of the GNU General Public License
30  along with this program. If not, see <http://www.gnu.org/licenses/>.
31 """
32 
33 import platform, os
34 
35 if platform.system()=="Linux":
36  userShareDir="~/.scolasync"
37  logFileName="~/.scolasync/scolasync.log"
38  markFileName="~/.scolasync/marques.py"
39 elif platform.system()=="Windows":
40  # to be implemented
41  userShareDir="??"
42  logFileName="??"
43  markFileName="??"
44 
45 ##
46 #
47 # Renvoie le premier répertoire existant d'une liste de propositions
48 # @param l la liste de propositions
49 #
50 def firstdir(l):
51  for d in l:
52  if os.path.isdir(d): return d
53  return None
54 
55 ##
56 #
57 # Renvoie le répertoire où trouver telle ou telle ressource
58 # @param which le type de ressource
59 #
60 def _dir(which):
61  if which=="lang":
62  return firstdir(["/usr/share/scolasync/lang", "lang"])
63  elif which=="help":
64  return firstdir(["/usr/share/scolasync/help", "help"])
65  elif which=="share":
66  return firstdir(["/usr/share/scolasync/","share"])
67  return None
68 
69