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