Beispiel #1
0
    def save_persistent(self, data):
        """
        Saves `data` as the persistent data. Data is a binary string giving
        the persistent data in python format.
        """

        with disk_lock:

            if not self.active:
                return

            fn = self.persistent
            fn_tmp = fn + tmp
            fn_new = fn + ".new"

            with open(fn_tmp, "wb") as f:
                f.write(data)

            safe_rename(fn_tmp, fn_new)
            safe_rename(fn_new, fn)

            # Prevent persistent from unpickle just after save
            self.persistent_mtime = os.path.getmtime(fn)

            renpy.util.expose_file(fn)

            self.sync()
Beispiel #2
0
    def save_persistent(self, data):
        """
        Saves `data` as the persistent data. Data is a binary string giving
        the persistent data in python format.
        """

        with disk_lock:

            if not self.active:
                return

            fn = self.persistent
            fn_new = fn + ".new"

            with open(fn_new, "wb") as f:
                f.write(data)

            safe_rename(fn_new, fn)
Beispiel #3
0
    def save_persistent(self, data):
        """
        Saves `data` as the persistent data. Data is a binary string giving
        the persistent data in python format.
        """

        with disk_lock:

            if not self.active:
                return

            fn = self.persistent
            fn_new = fn + ".new"

            with open(fn_new, "wb") as f:
                f.write(data)

            safe_rename(fn_new, fn)
Beispiel #4
0
    def rename(self, old, new):
        """
        If old exists, renames it to new.
        """

        with disk_lock:

            old = self.filename(old)
            new = self.filename(new)

            if not os.path.exists(old):
                return

            old_tmp = old + tmp
            safe_rename(old, old_tmp)
            safe_rename(old_tmp, new)
            renpy.util.expose_file(new)

            self.sync()
            self.scan()