Ignore case to decide format

Otherwise strange people that use uppercase names will get issues.

Closes: #59
This commit is contained in:
Salvo 'LtWorf' Tomaselli 2022-01-23 13:44:01 +01:00
parent 8b6d739365
commit 453f5c5002
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF

View File

@ -93,7 +93,7 @@ class UserInterface:
Files ending with .csv are loaded as csv, the others are Files ending with .csv are loaded as csv, the others are
loaded as json. loaded as json.
''' '''
if filename.endswith('.csv'): if filename.lower().endswith('.csv'):
rel = Relation.load_csv(filename) rel = Relation.load_csv(filename)
else: else:
rel = Relation.load(filename) rel = Relation.load(filename)
@ -105,7 +105,7 @@ class UserInterface:
def store(self, filename: str, name: str) -> None: def store(self, filename: str, name: str) -> None:
'''Stores a relation to file.''' '''Stores a relation to file.'''
if filename.endswith('.csv'): if filename.lower().endswith('.csv'):
self.relations[name].save_csv(filename) self.relations[name].save_csv(filename)
else: else:
self.relations[name].save(filename) self.relations[name].save(filename)