From 13d720389a01161a327a30918ad7ac9eec4a3d6c Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 20 Dec 2009 16:30:30 +0100 Subject: [not tested] Introduced StreamApp.class --- Source/Library/Common/FileStream.class.cpp | 13 +++++++------ Source/Library/Common/FileStream.class.h | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Source/Library/Common') diff --git a/Source/Library/Common/FileStream.class.cpp b/Source/Library/Common/FileStream.class.cpp index 6154b2f..322e9aa 100644 --- a/Source/Library/Common/FileStream.class.cpp +++ b/Source/Library/Common/FileStream.class.cpp @@ -4,11 +4,16 @@ // INPUT FILE STREAM // ******************** -FileIStream::FileIStream(const String &filename, u8int encoding, FSNode start) { +FileIStream::FileIStream(const String &filename, u8int encoding, FSNode start) : m_start(start) { m_file = new File(filename, FM_READ, start); m_encoding = encoding; } +FileIStream::FileIStream(u8int encoding, FSNode start) : m_start(start) { + m_file = 0; + m_encoding = encoding; +} + FileIStream::~FileIStream() { if (m_file != 0) { m_file->close(); @@ -33,11 +38,7 @@ String FileIStream::read() { if (m_filenames == 0) { return ""; } else { -#ifdef THIS_IS_MELON_KERNEL - m_file = new File(m_filenames->v(), FM_READ); -#else - m_file = new File(m_filenames->v(), FM_READ, FS::cwdNode()); -#endif + m_file = new File(m_filenames->v(), FM_READ, m_start); m_filenames = m_filenames->delThis(); } } diff --git a/Source/Library/Common/FileStream.class.h b/Source/Library/Common/FileStream.class.h index d0fb971..99bf0e8 100644 --- a/Source/Library/Common/FileStream.class.h +++ b/Source/Library/Common/FileStream.class.h @@ -18,9 +18,11 @@ class FileIStream : public IStream { File *m_file; u8int m_encoding; + FSNode m_start; public: FileIStream(const String &filename, u8int encoding = UE_UTF8, FSNode start = FSNode(0)); + FileIStream(u8int encoding = UE_UTF8, FSNode start = FSNode(0)); ~FileIStream(); void appendFile(const String &filename); -- cgit v1.2.3