mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
check if the file can be created at exporting events
This commit is contained in:
@ -17,6 +17,12 @@ class IcsExporter {
|
||||
var eventsFailed = 0
|
||||
|
||||
fun exportEvents(context: Context, file: File, events: ArrayList<Event>): ExportResult {
|
||||
try {
|
||||
file.createNewFile()
|
||||
} catch (e: Exception) {
|
||||
return EXPORT_FAIL
|
||||
}
|
||||
|
||||
file.bufferedWriter().use { out ->
|
||||
out.writeLn(BEGIN_CALENDAR)
|
||||
for (event in events) {
|
||||
|
Reference in New Issue
Block a user