Fix FileStream.close and let the file test clean up after itself.
This commit is contained in:
parent
cf75d968d5
commit
5bbf07beb8
|
@ -393,8 +393,17 @@ struct FileStream {
|
|||
m_size = eventDriver.files.getSize(fd);
|
||||
}
|
||||
|
||||
this(this) { eventDriver.files.addRef(m_fd); }
|
||||
~this() { eventDriver.files.releaseRef(m_fd); }
|
||||
this(this)
|
||||
{
|
||||
if (m_fd != FileFD.init)
|
||||
eventDriver.files.addRef(m_fd);
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
if (m_fd != FileFD.init)
|
||||
eventDriver.files.releaseRef(m_fd);
|
||||
}
|
||||
|
||||
@property int fd() { return m_fd; }
|
||||
|
||||
|
|
|
@ -21,4 +21,7 @@ void main()
|
|||
f.seek(2);
|
||||
f.read(dst);
|
||||
assert(dst[] == [3, 4, 5, 6, 7]);
|
||||
f.close();
|
||||
|
||||
removeFile("test.dat");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue