Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
HGStyle authored Jul 30, 2023
1 parent dff7363 commit 37cfb0e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ def ask_for_path(question):

def backup_file(file, dir):
# Simple function to create a backup
shutil.copyfile(file, os.path.join(dir, file))
shutil.copyfile(file, os.path.join(dir, os.path.basename(file)))
return True

def create_backup_dir(path):
# Simple function to create backup directory
dirname = "backup_" + datetime.datetime.now().strftime('Y%Y-M%m-D%d-h%H')
if dirname not in os.listdir():
if not os.path.exists(os.path.join(path, dirname)):
os.mkdir(os.path.join(path, dirname))
return os.path.join(path, dirname)

Expand Down Expand Up @@ -211,6 +211,8 @@ def search_savefile(name, path, print_results=False):
savefile = input('Input savefile path to add (empty to start fixing) -> ')
if not savefile:
break
elif not os.path.exists(savefile):
input('Savefile does not exists, check the filepath. Press enter to continue.')
elif not os.access(savefile, os.R_OK):
# Cannot access to path, gave tips to user based on the OS
if systemname == "android":
Expand All @@ -220,8 +222,6 @@ def search_savefile(name, path, print_results=False):
else:
print('Access denied, try to relaunch this programm as root/administrator.')
input('Press Ctrl+C to exit, press enter to continue.')
elif not os.path.exists(savefile):
input('Savefile does not exists, check the filepath. Press enter to continue.')
else:
savefiles.append(savefile)
clear_screen()
Expand Down Expand Up @@ -374,7 +374,7 @@ def search_savefile(name, path, print_results=False):
success = 0
for savefile in savefiles:
try:
result = fix_savefile(savefile)
result = fix_savefile(savefile, systemname)
print("Savefile fixed: " + savefile)
success += 1
except:
Expand Down

0 comments on commit 37cfb0e

Please sign in to comment.