Beispiel #1
0
    def _get_state_dir(self):
        config_name = self.config_name
        if not config_name:
            config_name = "Default"

        # Use a temporary state dir, for now, to avoid problems with
        # floppy overlays etc interfering with net play.
        if self.fsgc.netplay.enabled:
            # It is possible to manually specify the state dir.
            config_name = self.fsgc.config.get("__netplay_state_dir_name")
            if not config_name:
                # This is the default behavior, create a clean state
                # dir for the net play session.
                netplay_game = self.fsgc.config.get("__netplay_game")
                if netplay_game:
                    config_name = "Net Play ({0})".format(netplay_game)

        # Convert the config name to a name which can be represented on
        # the file system (really all/most filesystems).
        config_name = GameNameUtil.create_fs_name(config_name)

        letter = self.get_letter(config_name)
        if not letter:
            config_name = "Default"
            letter = self.get_letter(config_name)
        # We use an existing state dir in a "letter" dir if it already
        # exists (legacy support).
        path = os.path.join(FSGSDirectories.get_save_states_dir(), letter,
                            config_name)
        if os.path.exists(path):
            return path
        # If not, we use a direct sub-folder of save states dir.
        path = os.path.join(FSGSDirectories.get_save_states_dir(), config_name)
        return path
Beispiel #2
0
    def _get_state_dir(self):
        config_name = self.config_name
        if not config_name:
            config_name = "Default"

        # Use a temporary state dir, for now, to avoid problems with
        # floppy overlays etc interfering with net play.
        if self.fsgc.netplay.enabled:
            # It is possible to manually specify the state dir.
            config_name = self.fsgc.config.get("__netplay_state_dir_name")
            if not config_name:
                # This is the default behavior, create a clean state
                # dir for the net play session.
                netplay_game = self.fsgc.config.get("__netplay_game")
                if netplay_game:
                    config_name = "Net Play ({0})".format(netplay_game)

        # Convert the config name to a name which can be represented on
        # the file system (really all/most filesystems).
        config_name = GameNameUtil.create_fs_name(config_name)

        letter = self.get_letter(config_name)
        if not letter:
            config_name = "Default"
            letter = self.get_letter(config_name)
        # We use an existing state dir in a "letter" dir if it already
        # exists (legacy support).
        path = os.path.join(
            FSGSDirectories.get_save_states_dir(), letter, config_name
        )
        if os.path.exists(path):
            return path
        # If not, we use a direct sub-folder of save states dir.
        path = os.path.join(FSGSDirectories.get_save_states_dir(), config_name)
        return path
Beispiel #3
0
 def get_state_dir(self):
     """This is the old deprecated save sate directory for games."""
     state_dir = os.path.join(FSGSDirectories.get_save_states_dir(),
                              GameNameUtil.create_fs_name(self.get_name()))
     if not os.path.exists(state_dir):
         os.makedirs(state_dir)
     if self.fsgc.game.variant.uuid:
         uuid_file = os.path.join(state_dir, "uuid.txt")
         with io.open(uuid_file, "w", encoding="UTF-8") as f:
             f.write(self.fsgc.game.variant.uuid + "\n")
     # timestamp_file = os.path.join(state_dir, "timestamp.txt")
     # with open(timestamp_file, "wb") as f:
     #     f.write("\n")
     return state_dir
Beispiel #4
0
    def get_state_dir(self):
        state_dir = os.path.join(
            FSGSDirectories.get_save_states_dir(),
            GameNameUtil.create_fs_name(self.get_name()))
        if not os.path.exists(state_dir):
            os.makedirs(state_dir)
        if self.fsgs.game.variant.uuid:
            uuid_file = os.path.join(state_dir, "uuid.txt")
            with io.open(uuid_file, "w", encoding="UTF-8") as f:
                f.write(self.fsgs.game.variant.uuid + "\n")
        # timestamp_file = os.path.join(state_dir, "timestamp.txt")
        # with open(timestamp_file, "wb") as f:
        #     f.write("\n")

        return state_dir
Beispiel #5
0
 def screenshots_name(self):
     # FIXME: REMOVE?
     return GameNameUtil.create_fs_name(self.game_name())
Beispiel #6
0
 def screenshots_name(self):
     return GameNameUtil.create_fs_name(self.get_name())
Beispiel #7
0
 def screenshots_name(self):
     return GameNameUtil.create_fs_name(self.get_name())
 def screenshots_name(self):
     # FIXME: REMOVE?
     return GameNameUtil.create_fs_name(self.game_name())