DFortune

Unix fortune-cookie parser written in D
git clone git://xatko.vsos.ethz.ch/DFortune.git
Log | Files | Refs

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:
dfortune.d | 5+++++
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();