mirror of
https://gitlab.com/GameFeverOnline/mmm-nsf-changer.git
synced 2025-12-17 01:17:43 -04:00
Reduced likelihood of mmm crash
This commit is contained in:
parent
315a036904
commit
6a42701161
1 changed files with 14 additions and 1 deletions
|
|
@ -71,6 +71,18 @@ def check_folder_structure(megamaker_folder, og_music=False):
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def copy_music_to_ogmusic(path):
|
||||||
|
path = os.path.abspath(path)
|
||||||
|
original_filepaths = check_folder_structure(path)
|
||||||
|
if original_filepaths:
|
||||||
|
if not filecmp.cmp(os.path.join(path,"Music","MM1","Cutman.nsf"), os.path.join(path, "Music", "MM1", "Oilman.nsf"), shallow=False):
|
||||||
|
shutil.copytree(os.path.join(path, "Music"), os.path.join(path, "original_music"), dirs_exist_ok=True)
|
||||||
|
if not os.path.exists(os.path.join(path, "Music")):
|
||||||
|
os.makedirs(os.path.join(path, "Music"))
|
||||||
|
else:
|
||||||
|
print("Cutman.nsf and Oilman.nsf match in Music folder.")
|
||||||
|
return False
|
||||||
|
|
||||||
#this needs to check if original_music exists, and if it does restore_ogmusic before moving to og music.
|
#this needs to check if original_music exists, and if it does restore_ogmusic before moving to og music.
|
||||||
def move_music_to_ogmusic(path):
|
def move_music_to_ogmusic(path):
|
||||||
path = os.path.abspath(path)
|
path = os.path.abspath(path)
|
||||||
|
|
@ -128,7 +140,8 @@ def nsf_changer (nsf_path, megamaker_folder):
|
||||||
restore_ogmusic(megamaker_folder)
|
restore_ogmusic(megamaker_folder)
|
||||||
shutil.copy(nsf_path, os.path.join(megamaker_folder, os.path.basename(nsf_path)))
|
shutil.copy(nsf_path, os.path.join(megamaker_folder, os.path.basename(nsf_path)))
|
||||||
nsf_path = os.path.join(megamaker_folder, os.path.basename(nsf_path))
|
nsf_path = os.path.join(megamaker_folder, os.path.basename(nsf_path))
|
||||||
move_music_to_ogmusic(megamaker_folder)
|
#move_music_to_ogmusic(megamaker_folder)
|
||||||
|
copy_music_to_ogmusic(megamaker_folder)
|
||||||
recreate_structure(nsf_path, original_path)
|
recreate_structure(nsf_path, original_path)
|
||||||
print("nsf changer returning true")
|
print("nsf changer returning true")
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue