From 9c229b94d0aa52679e12e50d62aa8e6cbf9fb9c5 Mon Sep 17 00:00:00 2001 From: Orangerot Date: Tue, 7 Jan 2025 06:38:34 +0100 Subject: style: refactored searching files into Simfile class --- lib/simfile.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/simfile.dart') diff --git a/lib/simfile.dart b/lib/simfile.dart index 764e3aa..7bdf5c0 100644 --- a/lib/simfile.dart +++ b/lib/simfile.dart @@ -124,7 +124,8 @@ class Simfile { simfilePath = Directory(directoryPath) .listSync() .firstWhere((entity) => entity.path.endsWith('.sm'), - orElse: () => File('')).path; + orElse: () => File('')) + .path; audioPath = Directory(directoryPath) .listSync() @@ -132,6 +133,12 @@ class Simfile { orElse: () => File('')) .path; + bannerPath = Directory(directoryPath) + .listSync() + .firstWhere((file) => file.path.toLowerCase().endsWith('banner.png'), + orElse: () => File('')) + .path; + lines = File(simfilePath!).readAsStringSync(); RegExp commentsRegExp = RegExp(r'//.*$'); -- cgit v1.2.3