Example #1
0
 def set_rc(self, game_id, contents):
     rcfile_path = util.dgl_format_str(config.games[game_id]["rcfile_path"],
                                       self.username, config.games[game_id])
     rcfile_path = os.path.join(rcfile_path, self.username + ".rc")
     with open(rcfile_path, 'wb') as f:
         # TODO: is binary + encode necessary in py 3?
         f.write(utf8(contents))
Example #2
0
 def set_rc(self, game_id, contents):
     rcfile_path = util.dgl_format_str(config.games[game_id]["rcfile_path"],
                                       self.username, config.games[game_id])
     rcfile_path = os.path.join(rcfile_path, self.username + ".rc")
     try:
         with open(rcfile_path, 'wb') as f:
             # TODO: is binary + encode necessary in py 3?
             f.write(utf8(contents))
     except Exception:
         self.logger.warning("Couldn't save rcfile for %s!",
                             self.username,
                             exc_info=True)
         return False
     return True
Example #3
0
 def rcfile_path(self, game_id):
     if game_id not in config.games: return None
     if not self.username: return None
     path = util.dgl_format_str(config.games[game_id]["rcfile_path"],
                                self.username, config.games[game_id])
     return os.path.join(path, self.username + ".rc")
Example #4
0
 def format_path(self, path):
     return dgl_format_str(path, self.username, self.game_params)