saveProfiles method
Saves launcher profiles to disk.
Throws an exception if profiles have not been loaded or if saving fails.
Implementation
Future<void> saveProfiles() async {
if (_profiles == null) {
throw Exception('Launcher profiles not loaded');
}
final launcherProfilesPath = p.join(gameDir, 'launcher_profiles.json');
final profilesFile = File(launcherProfilesPath);
try {
final jsonString = json.encode(_profiles!.toJson());
await profilesFile.writeAsString(jsonString, flush: true);
} catch (e) {
debugPrint('Error saving launcher profiles: $e');
throw Exception('Failed to save launcher profiles: $e');
}
}