fix: do not resume if file can't be opened
This commit is contained in:
parent
c3f8d02e61
commit
bf3a9a35ce
@ -76,4 +76,4 @@ func from_csv_line(line: PackedStringArray) -> TimeEntry:
|
||||
return self
|
||||
|
||||
func _to_string() -> String:
|
||||
return "%s\t%s\t%s"%[name, Consts.ONGOING if closed == false else "", start_time]
|
||||
return "%s\t%s\t%s"%[name, Consts.ONGOING if closed == false else "", start_time]
|
||||
|
@ -43,6 +43,7 @@ func start_entry(entry_name: String) -> void:
|
||||
var file := FileAccess.open(source_path, FileAccess.READ_WRITE)
|
||||
if file == null:
|
||||
printerr("Could not open file")
|
||||
return
|
||||
entries.append(current_entry)
|
||||
file.store_csv_line(current_entry.to_csv_line())
|
||||
|
||||
@ -69,6 +70,7 @@ func save() -> void:
|
||||
var file := FileAccess.open(source_path, FileAccess.WRITE)
|
||||
if file == null:
|
||||
printerr("Could not open file")
|
||||
return
|
||||
for time_entry in entries:
|
||||
file.store_csv_line(time_entry.to_csv_line())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user