check if the file can be created at exporting events

This commit is contained in:
tibbi 2017-05-05 18:04:09 +02:00
parent b05c501bcb
commit d78f3ea73c
1 changed files with 6 additions and 0 deletions

View File

@ -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) {