mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
More Rubocop changes
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
module SaveData
|
||||
# Contains the file path of the save file.
|
||||
FILE_PATH = if File.directory?(System.data_directory)
|
||||
System.data_directory + '/Game.rxdata'
|
||||
System.data_directory + "/Game.rxdata"
|
||||
else
|
||||
'./Game.rxdata'
|
||||
"./Game.rxdata"
|
||||
end
|
||||
|
||||
# @return [Boolean] whether the save file exists
|
||||
@@ -45,7 +45,7 @@ module SaveData
|
||||
save_data = get_data_from_file(file_path)
|
||||
save_data = to_hash_format(save_data) if save_data.is_a?(Array)
|
||||
if !save_data.empty? && run_conversions(save_data)
|
||||
File.open(file_path, 'wb') { |file| Marshal.dump(save_data, file) }
|
||||
File.open(file_path, "wb") { |file| Marshal.dump(save_data, file) }
|
||||
end
|
||||
return save_data
|
||||
end
|
||||
@@ -57,14 +57,14 @@ module SaveData
|
||||
def self.save_to_file(file_path)
|
||||
validate file_path => String
|
||||
save_data = self.compile_save_hash
|
||||
File.open(file_path, 'wb') { |file| Marshal.dump(save_data, file) }
|
||||
File.open(file_path, "wb") { |file| Marshal.dump(save_data, file) }
|
||||
end
|
||||
|
||||
# Deletes the save file (and a possible .bak backup file if one exists)
|
||||
# @raise [Error::ENOENT]
|
||||
def self.delete_file
|
||||
File.delete(FILE_PATH)
|
||||
File.delete(FILE_PATH + '.bak') if File.file?(FILE_PATH + '.bak')
|
||||
File.delete(FILE_PATH + ".bak") if File.file?(FILE_PATH + ".bak")
|
||||
end
|
||||
|
||||
# Converts the pre-v19 format data to the new format.
|
||||
@@ -85,12 +85,12 @@ module SaveData
|
||||
# already exists in {FILE_PATH}.
|
||||
def self.move_old_windows_save
|
||||
return if File.file?(FILE_PATH)
|
||||
game_title = System.game_title.gsub(/[^\w ]/, '_')
|
||||
home = ENV['HOME'] || ENV['HOMEPATH']
|
||||
game_title = System.game_title.gsub(/[^\w ]/, "_")
|
||||
home = ENV["HOME"] || ENV["HOMEPATH"]
|
||||
return if home.nil?
|
||||
old_location = File.join(home, 'Saved Games', game_title)
|
||||
old_location = File.join(home, "Saved Games", game_title)
|
||||
return unless File.directory?(old_location)
|
||||
old_file = File.join(old_location, 'Game.rxdata')
|
||||
old_file = File.join(old_location, "Game.rxdata")
|
||||
return unless File.file?(old_file)
|
||||
File.move(old_file, FILE_PATH)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user