コード例 #1
0
ファイル: savelocation.py プロジェクト: uyjulian/renpy
    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()
コード例 #2
0
ファイル: savelocation.py プロジェクト: paulmorio/renpy
    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)
コード例 #3
0
ファイル: savelocation.py プロジェクト: picobyte/renpy
    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)
コード例 #4
0
ファイル: savelocation.py プロジェクト: uyjulian/renpy
    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()