Exemplo n.º 1
0
 def retrieve_data_directory(self):
     """
     Retrieve the data directory
     Look first into config_filename_global
     then into config_filename_user. The latter takes preeminence.
     """
     args = self.args
     try:
         if args['datadirectory']:
             aux.ensure_dir(args['datadirectory'])
             return args['datadirectory']
     except KeyError:
         pass
     config = configparser.ConfigParser()
     config.read([config_filename_global, self.config_filename_user])
     section = config.default_section
     data_path = config.get(section, 'Data directory',
                            fallback='~/.local/share/greg')
     data_path_expanded = os.path.expanduser(data_path)
     aux.ensure_dir(data_path_expanded)
     return os.path.expanduser(data_path_expanded)
Exemplo n.º 2
0
 def retrieve_data_directory(self):
     """
     Retrieve the data directory
     Look first into config_filename_global
     then into config_filename_user. The latter takes preeminence.
     """
     args = self.args
     try:
         if args['datadirectory']:
             aux.ensure_dir(args['datadirectory'])
             return args['datadirectory']
     except KeyError:
         pass
     config = configparser.ConfigParser()
     config.read([config_filename_global, self.config_filename_user])
     section = config.default_section
     data_path = config.get(section,
                            'Data directory',
                            fallback='~/.local/share/greg')
     data_path_expanded = os.path.expanduser(data_path)
     aux.ensure_dir(data_path_expanded)
     return os.path.expanduser(data_path_expanded)