commit 9cbe35da0343c0fad89ae5ec0ef8c3d15f528069
parent ba39ede8dab54dc27331cdd3cc14b12b1efd717d
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Sun, 9 Aug 2015 14:31:01 +0200
Add a destructor.
It simply closes the FDs, if they are open.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/dfortune.d b/dfortune.d
@@ -47,6 +47,11 @@ class Fortune : RandomAccessFinite!(string){
dst=EncodingScheme.create(encodingName!(char));
initialize();
}
+ ~this(){
+ if(table.isOpen || content.isOpen){
+ close();
+ }
+ }
public void initialize(){
open();