From 505f4214c19caa371f2b6e8dcd100c550ac5263f Mon Sep 17 00:00:00 2001 From: mshirt Date: Sun, 1 Jan 2017 18:25:11 -0600 Subject: [PATCH] Fixing EACCES error That occurs when trying to copy the ______.exe when you already have it running in the destination folder. --- scripts/Script.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/Script.rb b/scripts/Script.rb index 47b02f0..b401a3c 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -279,13 +279,17 @@ module Script 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\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") - File.open("_______.exe", "rb") do |input| - File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\_______.exe","wb") do |output| - while buff = input.read(4096) - output.write(buff) + begin + File.open("_______.exe", "rb") do |input| + File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\_______.exe","wb") do |output| + while buff = input.read(4096) + output.write(buff) + end end end - end + rescue Errno::EACCES => e + #this probably means the clover.exe already exists and is running, so no need to create it again + end if File.exists?("README.txt") File.open("README.txt", "rb") do |input| File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\README.txt","wb") do |output|