enforce log folder creation on windows
authorOliver Maurhart <oliver.maurhart@ait.ac.at>
Wed, 19 Feb 2014 11:39:34 +0100
changeset 73a68be2fa6039
parent 72 9c747741aff2
child 74 a17c4cf8cd38
enforce log folder creation on windows
OpenSecurity/bin/environment.py
     1.1 --- a/OpenSecurity/bin/environment.py	Wed Feb 19 11:39:02 2014 +0100
     1.2 +++ b/OpenSecurity/bin/environment.py	Wed Feb 19 11:39:34 2014 +0100
     1.3 @@ -96,7 +96,7 @@
     1.4          
     1.5          """the path where log files should be stored"""
     1.6          
     1.7 -        user_log_path = os.path.expanduser('~/.log')
     1.8 +        user_log_path = os.path.expanduser(os.path.join('~', '.log'))
     1.9          
    1.10          if sys.platform == 'linux2':
    1.11              
    1.12 @@ -113,6 +113,12 @@
    1.13              return user_log_path
    1.14          
    1.15          elif sys.platform == 'win32' or sys.platform == 'cygwin':
    1.16 +
    1.17 +            if not os.path.exists(user_log_path):
    1.18 +                os.mkdir(user_log_path)
    1.19 +            elif not os.path.isdir(user_log_path):
    1.20 +                raise IOError(user_log_path + ': not a folder')
    1.21 +
    1.22              return user_log_path
    1.23          
    1.24          else: