Hardware-Target-Game-Database icon indicating copy to clipboard operation
Hardware-Target-Game-Database copied to clipboard

Extras folder

Open blathers16 opened this issue 1 year ago • 4 comments

This pull request is to allow copying files found in the source directory that are not found in the database to a designated folder when running the build pack script. The rationale behind this is that you may have a bunch of ROMs from various sources randomly mixed together. Since there is no guarantee that these databases will always have every ROM in existence in them, with this change any roms from the source folder will either end up in the build pack or in the extras folder. The user can then safely keep only a copy of the built pack and the extras folder with the knowledge that they haven't deleted any ROMs from the source that are not yet in the db. This can also help in keeping the db up to date, as any files that end up in the extras folder can be investigated to determine whether they need to be added to the db.

blathers16 avatar Mar 25 '23 23:03 blathers16

@tjanas can I get this looked at? Do you need me to file an issue to go with it or something?

blathers16 avatar Jun 02 '23 21:06 blathers16

I would ask @frederic-mahe instead

tjanas avatar Jun 03 '23 05:06 tjanas

@blathers16 I am really sorry for not looking at your pull request earlier. I was hoping to refactor my build_pack.py script first, but I've been too busy with work.

Before merging your new option, there are a few things that could be improved or clarified. I hope you won't mind.

For instance, that check could be done only once, rather than for each file in the source folder:

# create directory structure if need be
if not os.path.exists(new_path):
    os.makedirs(new_path, exist_ok=True)

Also, there is a possibility that someone will put the extras_folder in the source or destination folder by mistake. As it is, the script should work as expected, but that needs to be tested.

Finally, I am not sure to understand your strategy when there are multiple source files with the same name. You add part of the hash value to the filename h[0:4]. Assuming that same-name files can only appear in different sub-folders, an alternative to name alteration could be to simply recreate the source subfolders in the extras_folder. What do you think of that?

frederic-mahe avatar Jun 05 '23 17:06 frederic-mahe

Hi, @frederic-mahe I made the requested changes. I have also tested and confirmed that putting the extras folder in either the input or the output folder does not cause problems, nor does specifying an extras folder that does not yet exist.

blathers16 avatar Oct 16 '23 18:10 blathers16