dsiver144

EDIT SAVE FOLDER

Jul 22nd, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #===============================================================================
  2. # * EDIT SAVE FOLDER
  3. # by dsiver144
  4. #===============================================================================
  5. SAVE_FOLDER = "Diary" # You can freely change it to what you want.
  6. module DataManager
  7. #--------------------------------------------------------------------------
  8. # * Determine Existence of Save File
  9. #--------------------------------------------------------------------------
  10. def self.save_file_exists?
  11. if !File.directory?(SAVE_FOLDER)
  12. Dir.mkdir(SAVE_FOLDER)
  13. end
  14. return !Dir.glob(SAVE_FOLDER + '/Save*.rvdata2').empty?
  15. end
  16. #--------------------------------------------------------------------------
  17. # * Create Filename
  18. # index : File Index
  19. #--------------------------------------------------------------------------
  20. def self.make_filename(index)
  21. if !File.directory?(SAVE_FOLDER)
  22. Dir.mkdir(SAVE_FOLDER)
  23. end
  24. return sprintf(SAVE_FOLDER + "/Save%02d.rvdata2", index + 1)
  25. end
  26. end # DataManager
  27.  
  28. module LGlobalSave
  29. FILE_NAME = SAVE_FOLDER + "/GlobalSave.rvdata2"
  30. def self.saveTheFile(f)
  31. if !File.directory?(SAVE_FOLDER)
  32. Dir.mkdir(SAVE_FOLDER)
  33. end
  34. File.open(FILE_NAME, "wb") do |file|
  35. Marshal.dump(f, file)
  36. end
  37. end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment