Skip to content

Commit

Permalink
add "_and_more" if folder name is cutted
Browse files Browse the repository at this point in the history
  • Loading branch information
treee111 committed Nov 10, 2023
1 parent d5e399d commit 539894f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/test_osm_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def test_folder_name_many_countries(self):
folder_name = o_osm_maps.calculate_folder_name('.map.lzma')
folder_name_maps = o_osm_maps.calculate_folder_name('.map')

self.assertEqual(folder_name, 'albania_alps_andorra_austria_azores_belarus_belgiu')
self.assertEqual(folder_name_maps, 'albania_alps_andorra_austria_azores_belarus_belgiu-maps')
self.assertEqual(folder_name, 'albania_alps_andorra_austria_azores_belar_and_more')
self.assertEqual(folder_name_maps, 'albania_alps_andorra_austria_azores_belar_and_more-maps')

def test_encoding_open_sea_osm(self):
"""
Expand Down
5 changes: 4 additions & 1 deletion wahoomc/osm_maps_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,10 @@ def calculate_folder_name(self, extension):
that preserves crashing later on when creating the output folder
"""
# cut down to 100 (relevant if country_name is longer than 100 characters)
country_name_50_chars = self.o_osm_data.country_name[:50]
if len(self.o_osm_data.country_name) > 50:
country_name_50_chars = self.o_osm_data.country_name[:41] + '_and_more'
else:
country_name_50_chars = self.o_osm_data.country_name

if extension == '.map.lzma':
folder_name = country_name_50_chars
Expand Down

0 comments on commit 539894f

Please sign in to comment.