Skip to content

Commit

Permalink
Clean up potential errors if directory name ends with period
Browse files Browse the repository at this point in the history
- Clean up potential errors if directory name ends with period
  • Loading branch information
bbtufty committed Jan 9, 2025
1 parent db7537d commit 14034df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ROMParser
General
~~~~~~~

- Clean up potential errors if directory name ends with period
- regex cleanup
- Move clonelist from unexpectedpanda to Daeymon
- Updated RA name extensions
Expand Down
15 changes: 0 additions & 15 deletions romsearch/modules/romcleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,6 @@ def clean_roms(

rom_dir = rom_dict[r][f]["dir_name"]

# Catch the edge case where the directory name can end with
# a period (e.g. Super Smash Bros.)
if rom_dir.endswith("."):
rom_dir = rom_dir[:-1]

rom_name_w_dir = os.path.join(rom_dir, rom_name)

roms_in_dict.append(rom_name_w_dir)
Expand Down Expand Up @@ -207,11 +202,6 @@ def clean_roms(
# to a dir name
g_short = get_directory_name(g)

# Catch the edge case where the directory name can end with
# a period (e.g. Super Smash Bros.)
if g_short.endswith("."):
g_short = g_short[:-1]

for g_i in self.cache[self.platform][g]:

if found_entry_in_dict:
Expand Down Expand Up @@ -263,11 +253,6 @@ def clean_roms(
# to a dir name
d_short = get_directory_name(d)

# Catch the edge case where the directory name can end with
# a period (e.g. Super Smash Bros.)
if d_short.endswith("."):
d_short = d_short[:-1]

for d_i in self.cache[self.platform][d]:
found_d_i_on_disk = False

Expand Down
5 changes: 5 additions & 0 deletions romsearch/util/regex_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def get_directory_name(f):
if len(f_find) > 0:
f = f_find[0]

# Catch the edge case where the directory name can end with
# a period (e.g. Super Smash Bros.)
if f.endswith("."):
f = f[:-1]

return f


Expand Down

0 comments on commit 14034df

Please sign in to comment.