ScolaSync  4.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 python3safe=True
34 
35 import platform, os
36 
37 if platform.system()=="Linux":
38  userShareDir="~/.scolasync"
39  logFileName="~/.scolasync/scolasync.log"
40  markFileName="~/.scolasync/marques.py"
41 elif platform.system()=="Windows":
42  # to be implemented
43  userShareDir="??"
44  logFileName="??"
45  markFileName="??"
46 
47 ##
48 #
49 # Renvoie le premier répertoire existant d'une liste de propositions
50 # @param l la liste de propositions
51 #
52 def firstdir(l):
53  for d in l:
54  if os.path.isdir(d): return d
55  return None
56 
57 ##
58 #
59 # Renvoie le répertoire où trouver telle ou telle ressource
60 # @param which le type de ressource
61 #
62 def _dir(which):
63  if which=="lang":
64  return firstdir(["/usr/share/scolasync/lang", "lang"])
65  elif which=="help":
66  return firstdir(["/usr/share/scolasync/help", "help"])
67  elif which=="share":
68  return firstdir(["/usr/share/scolasync/","share"])
69  return None
70 
def firstdir
Renvoie le premier répertoire existant d'une liste de propositions.
Definition: globaldef.py:52