Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # Data Backup Utility
- # Author: ForeverZer0
- # Date: 4.15.2012
- # Version: 1.0
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #
- # Explanation:
- # Simple script for creating backups of your game each time the game is ran
- # in debug mode. Its runs very quickly and there is practically no slowdown,
- # even with large games.
- #
- # Features:
- # - Backups your Data folder automatically each debug run
- # - Configurable number of backups
- # - Runs on a separate thread and invokes system functions for the actual
- # processing to prevent any slowdown
- #
- # Instructions:
- # - Place script anywhere above "Main"
- # - Configure the number of backups you would like to keep.
- # - Backups will be stored in the "Backups" folder in the main game directory,
- # and are always listed in order of newest to oldest
- #
- # Credit/Thanks:
- # - ForeverZer0, for the script
- #
- # Authors Notes:
- # - Please report any bugs issues at www.chaos-project.com
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- module Backup
- MAX_BACKUPS = 10
- def self.create
- system("rd /s/q \"Backups\\Backup #{MAX_BACKUPS}\"")
- (1...MAX_BACKUPS).to_a.reverse.each {|i|
- dir_name = "Backups/Backup #{i}"
- Dir.mkdir(dir_name) unless File.directory?(dir_name)
- File.rename(dir_name, "Backups/Backup #{i + 1}")
- }
- system('xcopy Data "Backups\\Backup 1" /Y/D/I')
- end
- end
- if $DEBUG
- Thread.new { Backup.create }
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement