Use POSIX path separators

This commit is contained in:
tdixon 2017-08-01 23:29:42 -03:00
parent 4af06340de
commit c1fb09fcb5

View file

@ -373,11 +373,11 @@ module Script
end end
def self.copy_journal def self.copy_journal
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot")
begin begin
File.open("_______.exe", "rb") do |input| File.open("_______.exe", "rb") do |input|
File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\_______.exe","wb") do |output| File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/_______.exe","wb") do |output|
while buff = input.read(4096) while buff = input.read(4096)
output.write(buff) output.write(buff)
end end
@ -388,7 +388,7 @@ module Script
end end
if File.exists?("README.txt") if File.exists?("README.txt")
File.open("README.txt", "rb") do |input| File.open("README.txt", "rb") do |input|
File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\README.txt","wb") do |output| File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/README.txt","wb") do |output|
while buff = input.read(4096) while buff = input.read(4096)
output.write(buff) output.write(buff)
end end
@ -398,12 +398,12 @@ module Script
end end
def self.create_boxes def self.create_boxes
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal")
end end
def self.delete_if_exists(f_name) def self.delete_if_exists(f_name)
@ -412,25 +412,25 @@ module Script
def self.clear_boxes def self.clear_boxes
for i in 1..3 for i in 1..3
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + i.to_s portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + i.to_s
case i case i
when 1 when 1
delete_if_exists(portal_path + "\\blue_npc_prototype.png") delete_if_exists(portal_path + "/blue_npc_prototype.png")
delete_if_exists(portal_path + "\\proto1.png") delete_if_exists(portal_path + "/proto1.png")
delete_if_exists(portal_path + "\\keyB.txt") delete_if_exists(portal_path + "/keyB.txt")
when 2 when 2
delete_if_exists(portal_path + "\\green_npc_cedric.png") delete_if_exists(portal_path + "/green_npc_cedric.png")
delete_if_exists(portal_path + "\\cedric.png") delete_if_exists(portal_path + "/cedric.png")
delete_if_exists(portal_path + "\\keyG.txt") delete_if_exists(portal_path + "/keyG.txt")
when 3 when 3
delete_if_exists(portal_path + "\\red_rue.png") delete_if_exists(portal_path + "/red_rue.png")
delete_if_exists(portal_path + "\\rue.png") delete_if_exists(portal_path + "/rue.png")
delete_if_exists(portal_path + "\\keyR.txt") delete_if_exists(portal_path + "/keyR.txt")
end end
end end
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.txt") delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyB.txt")
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyG.txt") delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyG.txt")
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt") delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyR.txt")
end end
def self.copy_file(src, dst) def self.copy_file(src, dst)
@ -454,71 +454,71 @@ module Script
end end
def self.put_key_in_box(numb) def self.put_key_in_box(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s
case numb case numb
when 1 when 1
copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png") copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png")
copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.png") copy_file("Graphics/Faces/proto1.png", portal_path + "/proto1.png")
write_key(portal_path + "\\keyB.txt", PROTO_TEXT) write_key(portal_path + "/keyB.txt", PROTO_TEXT)
when 2 when 2
copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png") copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png")
copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\cedric.png") copy_file("Graphics/Faces/cedric.png", portal_path + "/cedric.png")
write_key(portal_path + "\\keyG.txt", CEDRIC_TEXT) write_key(portal_path + "/keyG.txt", CEDRIC_TEXT)
when 3 when 3
copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png") copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png")
copy_file("Graphics\\Faces\\rue.png", portal_path + "\\rue.png") copy_file("Graphics/Faces/rue.png", portal_path + "/rue.png")
write_key(portal_path + "\\keyR.txt", RUE_TEXT) write_key(portal_path + "/keyR.txt", RUE_TEXT)
end end
end end
def self.password1 def self.password1
copy_file("Graphics\\Fogs\\_\\scenario1\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") copy_file("Graphics/Fogs/_/scenario1/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") copy_file("Graphics/Fogs/_/scenario1/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") copy_file("Graphics/Fogs/_/scenario1/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") copy_file("Graphics/Fogs/_/scenario1/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png")
end end
def self.password2 def self.password2
copy_file("Graphics\\Fogs\\_\\scenario2\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") copy_file("Graphics/Fogs/_/scenario2/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") copy_file("Graphics/Fogs/_/scenario2/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") copy_file("Graphics/Fogs/_/scenario2/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") copy_file("Graphics/Fogs/_/scenario2/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png")
end end
=begin =begin
def self.take_key_out_of_box(numb) def self.take_key_out_of_box(numb)
if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
end end
if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png")
File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png")
end end
end end
=end =end
def self.is_key_in_box(numb) def self.is_key_in_box(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s
case numb case numb
when 1 when 1
return File.exists?(portal_path + "\\keyB.txt") return File.exists?(portal_path + "/keyB.txt")
when 2 when 2
return File.exists?(portal_path + "\\keyG.txt") return File.exists?(portal_path + "/keyG.txt")
when 3 when 3
return File.exists?(portal_path + "\\keyR.txt") return File.exists?(portal_path + "/keyR.txt")
end end
return false return false
end end
def self.is_key_in_bigbox(numb) def self.is_key_in_bigbox(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal" portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal"
case numb case numb
when 1 when 1
return File.exists?(portal_path + "\\keyB.txt") return File.exists?(portal_path + "/keyB.txt")
when 2 when 2
return File.exists?(portal_path + "\\keyG.txt") return File.exists?(portal_path + "/keyG.txt")
when 3 when 3
return File.exists?(portal_path + "\\keyR.txt") return File.exists?(portal_path + "/keyR.txt")
end end
return false return false
end end